From 75b4bf32355c52a2996070f9d74923992c0fbb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Via=C4=8Das=C5=82a=C5=AD=20Chalikin?= Date: Tue, 10 Oct 2023 05:28:36 +0300 Subject: [PATCH] Add Belarusian language option --- intl/msg_hash_us.h | 4 ++++ libretro-common/include/libretro.h | 5 +++-- menu/menu_setting.c | 14 +++++++++----- msg_hash.c | 19 ++++++++++++++++++- msg_hash.h | 1 + retroarch.c | 13 +++++++------ tasks/task_translation.c | 2 ++ translation_defines.h | 1 + 8 files changed, 45 insertions(+), 14 deletions(-) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 9da8361c63ca..229cf101bdec 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -9856,6 +9856,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_LANG_BASQUE, "Basque - Euskara" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_BELARUSIAN, + "Belarusian - Беларуская мова" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_LANG_BENGALI, "Bengali - বাংলা (Restart Required)" diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 54c05ca62c48..96d07df4481e 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -291,6 +291,7 @@ enum retro_language RETRO_LANGUAGE_CATALAN = 29, RETRO_LANGUAGE_BRITISH_ENGLISH = 30, RETRO_LANGUAGE_HUNGARIAN = 31, + RETRO_LANGUAGE_BELARUSIAN = 32, RETRO_LANGUAGE_LAST, /* Ensure sizeof(enum) == sizeof(int) */ @@ -3195,13 +3196,13 @@ enum retro_savestate_context /* Savestate where you are guaranteed that the same instance will load the save state. * You can store internal pointers to code or data. - * It's still a full serialization and deserialization, and could be loaded or saved at any time. + * It's still a full serialization and deserialization, and could be loaded or saved at any time. * It won't be written to disk or sent over the network. */ RETRO_SAVESTATE_CONTEXT_RUNAHEAD_SAME_INSTANCE = 1, /* Savestate where you are guaranteed that the same emulator binary will load that savestate. - * You can skip anything that would slow down saving or loading state but you can not store internal pointers. + * You can skip anything that would slow down saving or loading state but you can not store internal pointers. * It won't be written to disk or sent over the network. * Example: "Second Instance" runahead */ diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 9a4d14023d9f..b39e044d38d9 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -102,7 +102,7 @@ #include "../lakka.h" #ifdef HAVE_LAKKA_SWITCH #include "../lakka-switch.h" -#endif +#endif #include "../retroarch.h" #include "../gfx/video_display_server.h" #ifdef HAVE_CHEATS @@ -3183,6 +3183,9 @@ static void setting_get_string_representation_uint_ai_service_lang( case TRANSLATION_LANG_UK: enum_idx = MENU_ENUM_LABEL_VALUE_LANG_UKRAINIAN; break; + case TRANSLATION_LANG_BE: + enum_idx = MENU_ENUM_LABEL_VALUE_LANG_BELARUSIAN; + break; case TRANSLATION_LANG_UR: enum_idx = MENU_ENUM_LABEL_VALUE_LANG_URDU; break; @@ -6888,6 +6891,7 @@ static void setting_get_string_representation_uint_user_language( translated[RETRO_LANGUAGE_BRITISH_ENGLISH] = LANGUAGE_PROGRESS_ENGLISH_UNITED_KINGDOM_TRANSLATED; LANG_DATA(HUNGARIAN) + LANG_DATA(BELARUSIAN) if (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) == RETRO_LANGUAGE_ENGLISH) strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len); @@ -8856,7 +8860,7 @@ static void switch_cec_enable_toggle_change_handler(rarch_setting_t *setting) } else { filestream_delete(SWITCH_CEC_TOGGLE_PATH); } - + } static void bluetooth_ertm_disable_toggle_change_handler(rarch_setting_t *setting) @@ -8870,7 +8874,7 @@ static void bluetooth_ertm_disable_toggle_change_handler(rarch_setting_t *settin fprintf(f, "0\n"); fclose(f); } - + } #endif @@ -22017,7 +22021,7 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); (*list)[list_info->index - 1].change_handler = switch_oc_enable_toggle_change_handler; - + CONFIG_BOOL( list, list_info, &settings->bools.switch_cec, @@ -22033,7 +22037,7 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); (*list)[list_info->index - 1].change_handler = switch_cec_enable_toggle_change_handler; - + CONFIG_BOOL( list, list_info, &settings->bools.bluetooth_ertm_disable, diff --git a/msg_hash.c b/msg_hash.c index 8c278068e8bb..92c37af4199c 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -128,6 +128,8 @@ const char *get_user_language_iso639_1(bool limit) return "en_gb"; case RETRO_LANGUAGE_HUNGARIAN: return "hu"; + case RETRO_LANGUAGE_BELARUSIAN: + return "be"; } return "en"; } @@ -217,6 +219,18 @@ static const char *msg_hash_to_str_hu(enum msg_hash_enums msg) return "null"; } +static const char *msg_hash_to_str_be(enum msg_hash_enums msg) +{ + switch (msg) + { +#include "intl/msg_hash_be.h" + default: + break; + } + + return "null"; +} + static const char *msg_hash_to_str_en(enum msg_hash_enums msg) { switch (msg) @@ -607,6 +621,9 @@ const char *msg_hash_to_str(enum msg_hash_enums msg) case RETRO_LANGUAGE_HUNGARIAN: ret = msg_hash_to_str_hu(msg); break; + case RETRO_LANGUAGE_BELARUSIAN: + ret = msg_hash_to_str_be(msg); + break; default: break; } @@ -907,6 +924,6 @@ const char *msg_hash_get_wideglyph_str(void) break; } #endif - + return NULL; } diff --git a/msg_hash.h b/msg_hash.h index 99fddc252f00..f9a16b16a3b9 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3464,6 +3464,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_LANG_TELUGU, MENU_ENUM_LABEL_VALUE_LANG_THAI, MENU_ENUM_LABEL_VALUE_LANG_UKRAINIAN, + MENU_ENUM_LABEL_VALUE_LANG_BELARUSIAN, MENU_ENUM_LABEL_VALUE_LANG_URDU, MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA, MENU_ENUM_LABEL_VALUE_LANG_WELSH, diff --git a/retroarch.c b/retroarch.c index ddc0ca9eda09..ed063d6809e6 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3774,17 +3774,17 @@ bool command_event(enum event_command cmd, void *data) netplay_server = tmp_netplay_server; netplay_session = tmp_netplay_session; } - - if (p_rarch->connect_mitm_id) + + if (p_rarch->connect_mitm_id) netplay_session = strdup(p_rarch->connect_mitm_id); - - if (p_rarch->connect_host) + + if (p_rarch->connect_host) { free(p_rarch->connect_host); p_rarch->connect_host = NULL; } - if (p_rarch->connect_mitm_id) + if (p_rarch->connect_mitm_id) { free(p_rarch->connect_mitm_id); p_rarch->connect_mitm_id = NULL; @@ -6061,7 +6061,7 @@ static bool retroarch_parse_input_and_config( netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); p_rarch->connect_host = strdup(optarg); break; - + case 'T': p_rarch->connect_mitm_id = strdup(optarg); break; @@ -7282,6 +7282,7 @@ enum retro_language retroarch_get_language_from_iso(const char *iso639) {"en_GB", RETRO_LANGUAGE_BRITISH_ENGLISH}, {"en", RETRO_LANGUAGE_ENGLISH}, {"hu", RETRO_LANGUAGE_HUNGARIAN}, + {"be", RETRO_LANGUAGE_BELARUSIAN}, }; if (string_is_empty(iso639)) diff --git a/tasks/task_translation.c b/tasks/task_translation.c index 7082a273caca..0f71f293c0f7 100644 --- a/tasks/task_translation.c +++ b/tasks/task_translation.c @@ -752,6 +752,8 @@ static const char *ai_service_get_str(enum translation_lang id) return "tr"; case TRANSLATION_LANG_UK: return "uk"; + case TRANSLATION_LANG_BE: + return "be"; case TRANSLATION_LANG_UR: return "ur"; case TRANSLATION_LANG_VI: diff --git a/translation_defines.h b/translation_defines.h index 353825eb24d8..09c4565407d4 100644 --- a/translation_defines.h +++ b/translation_defines.h @@ -64,6 +64,7 @@ enum translation_lang TRANSLATION_LANG_TH, /* Thai */ TRANSLATION_LANG_TR, /* Turkish */ TRANSLATION_LANG_UK, /* Ukrainian */ + TRANSLATION_LANG_BE, /* Belarusian */ TRANSLATION_LANG_UR, /* Urdu */ TRANSLATION_LANG_VI, /* Vietnamese */ TRANSLATION_LANG_CY, /* Welsh */