Added 'es' locale!

This commit is contained in:
spla 2020-11-28 18:07:52 +01:00
pare 00e8b00835
commit f3b7af3e82

Veure arxiu

@ -994,7 +994,7 @@ def replying():
elif query_word[:search_move_slicing] == search_move: elif query_word[:search_move_slicing] == search_move:
moving = query_word[4:query_word_length].replace(" ","") moving = query_word[moving_slicing:query_word_length].replace(" ","")
reply = True reply = True
elif query_word == search_end: elif query_word == search_end:
@ -1165,7 +1165,7 @@ def create_dir():
def usage(): def usage():
print('usage: python ' + sys.argv[0] + ' --play' + ' --eng') print('usage: python ' + sys.argv[0] + ' --play' + ' --en')
############################################################################### ###############################################################################
# main # main
@ -1184,40 +1184,55 @@ if __name__ == '__main__':
if len(sys.argv) == 3: if len(sys.argv) == 3:
if sys.argv[2] == '--eng': if sys.argv[2] == '--en':
bot_lang = 'eng' bot_lang = 'en'
elif sys.argv[2] == '--es':
bot_lang = 'es'
else: else:
bot_lang = 'ca' bot_lang = 'ca'
if bot_lang == "ca": if bot_lang == 'ca':
language_filepath = "locales/cat.txt" language_filepath = 'locales/ca.txt'
elif bot_lang == "eng": elif bot_lang == 'en':
language_filepath = "locales/eng.txt" language_filepath = 'locales/en.txt'
elif bot_lang == 'es':
language_filepath = 'locales/es.txt'
else: else:
print("\nOnly 'cat' and 'eng' languages are supported.\n") print("\nOnly 'ca', 'es' and 'en' languages are supported.\n")
sys.exit(0) sys.exit(0)
if bot_lang == 'ca': if bot_lang == 'ca':
search_move_slicing = 3 search_move_slicing = 3
moving_slicing = 3
search_send_slicing = 5 search_send_slicing = 5
send_game_slicing = 6 send_game_slicing = 6
elif bot_lang == 'eng': elif bot_lang == 'en':
search_move_slicing = 4 search_move_slicing = 4
moving_slicing = 4
search_send_slicing = 4 search_send_slicing = 4
send_game_slicing = 5 send_game_slicing = 5
elif bot_lang == 'es':
search_move_slicing = 5
moving_slicing = 5
search_send_slicing = 5
send_game_slicing = 6
search_end, search_move, search_new, search_games, search_send, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error = load_strings(bot_lang) search_end, search_move, search_new, search_games, search_send, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error = load_strings(bot_lang)
game_number_anotations, anotations_sent, game_no_exists, it_not_exists, game_already_started, wait_other_player, is_not_legal_move, check_done, check_mate = load_strings1(bot_lang) game_number_anotations, anotations_sent, game_no_exists, it_not_exists, game_already_started, wait_other_player, is_not_legal_move, check_done, check_mate = load_strings1(bot_lang)
@ -1690,7 +1705,7 @@ if __name__ == '__main__':
query_word_length = len(query_word) query_word_length = len(query_word)
send_game = query_word[6:query_word_length].replace(' ', '') send_game = query_word[search_send_slicing:query_word_length].replace(' ', '')
emailed, game_id, game_found = send_anotation(send_game) emailed, game_id, game_found = send_anotation(send_game)
@ -1747,3 +1762,6 @@ if __name__ == '__main__':
i += 1 i += 1
else:
usage()