Hi,
I want to implement different languages in my game and now I am looking for some efficient ways to do that.
I have read a bit about html using scripts
or based of on text file where all lines are been saved
something like that I am looking for
example:
(just an part from an other script)
# command to creat a 'NEW Lobby'
if data[0] == '§NEWL§':
print(data[1])
max_user = data[1][0]
lobby_name = data[1][1]
lobby_privacy = data[1][2]
lobby_pw = data[1][3]
lobby_location = 'XX' ## not ready to use
try:
global_lobbies = [v for k, v in self.lobbies_specs.items() if lobby_name in v]
if global_lobbies == []:
if 2 <= max_user <= 10:
if lobby_pw == None:
if lobby_privacy[1] == 'open':
created = self.creat_lobby(req_addr, max_user, lobby_name, lobby_location, lobby_privacy, lobby_pw)
if created:
print('new_lobby will be added')
to_send = self.pack_data(('§ACK§', 'you creat succesfully your own lobby!'))
self.sendSingle(to_send, req_addr)
else:
raise Exception("some internal error has occoured to add you to your lobby!")
else:
raise Exception('you can not set an password at an open lobby, use close lobbies instead!')
elif lobby_privacy[1] == 'close':
if len(lobby_pw) > 3 or lobby_pw != None:
created = self.creat_lobby(req_addr, max_user, lobby_name, lobby_location, lobby_privacy, lobby_pw)
if created:
print('new_lobby will be added')
to_send = self.pack_data(('§ACK§', 'you creat succesfully your own lobby!'))
self.sendSingle(to_send, req_addr)
else:
raise Exception("some internal error has occoured to add you to your lobby!")
else:
raise Exception('your current lobby password is to short!')
else:
raise Exception('you can not set an password at an open lobby, use close lobbies instead!')
else:
raise Exception('your max_users setting is not between 2-10 players!')
else:
raise Exception('the name %s is given to another lobby please choose another name!' % lobby_name)
except Exception as e:
to_send = self.pack_data(('§ERROR§', str(e)))
print(e)
self.sendSingle(to_send, req_addr)
for each (in that case) Exception I want an language key and the line key and then the right language and line