From b89692c5329158e8b62b4c34e11d9893d67f08ed Mon Sep 17 00:00:00 2001 From: Michael Burgardt Date: Fri, 4 Nov 2022 19:52:39 +0100 Subject: [PATCH] Add Hungarian language option (#14585) --- Makefile.common | 3 +- gfx/drivers_font_renderer/bitmapfont_6x10.c | 2 +- griffin/griffin.c | 1 + intl/msg_hash_hu.c | 60 +++++++++++++++++++++ libretro-common/include/libretro.h | 1 + menu/drivers/rgui.c | 4 +- menu/menu_setting.c | 1 + msg_hash.c | 8 +++ msg_hash.h | 3 ++ retroarch.c | 1 + 10 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 intl/msg_hash_hu.c diff --git a/Makefile.common b/Makefile.common index 3b0b5d2349..1bd27ecaf0 100644 --- a/Makefile.common +++ b/Makefile.common @@ -475,7 +475,8 @@ ifeq ($(HAVE_LANGEXTRA), 1) intl/msg_hash_cs.o \ intl/msg_hash_val.o \ intl/msg_hash_ca.o \ - intl/msg_hash_en.o + intl/msg_hash_en.o \ + intl/msg_hash_hu.o endif ifneq ($(HAVE_GETOPT_LONG), 1) diff --git a/gfx/drivers_font_renderer/bitmapfont_6x10.c b/gfx/drivers_font_renderer/bitmapfont_6x10.c index 6372cfa731..2bd452e867 100644 --- a/gfx/drivers_font_renderer/bitmapfont_6x10.c +++ b/gfx/drivers_font_renderer/bitmapfont_6x10.c @@ -99,10 +99,10 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language) case RETRO_LANGUAGE_INDONESIAN: case RETRO_LANGUAGE_SWEDISH: case RETRO_LANGUAGE_CZECH: + case RETRO_LANGUAGE_HUNGARIAN: /* These languages are not yet added case RETRO_LANGUAGE_ROMANIAN: case RETRO_LANGUAGE_CROATIAN: - case RETRO_LANGUAGE_HUNGARIAN: case RETRO_LANGUAGE_SERBIAN: case RETRO_LANGUAGE_WELSH: */ diff --git a/griffin/griffin.c b/griffin/griffin.c index 213028f7db..3d0525f505 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1275,6 +1275,7 @@ RETROARCH #include "../intl/msg_hash_val.c" #include "../intl/msg_hash_ca.c" #include "../intl/msg_hash_en.c" +#include "../intl/msg_hash_hu.c" #endif #include "../intl/msg_hash_us.c" diff --git a/intl/msg_hash_hu.c b/intl/msg_hash_hu.c new file mode 100644 index 0000000000..0b11bcc638 --- /dev/null +++ b/intl/msg_hash_hu.c @@ -0,0 +1,60 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include + +#include +#include + +#include "../msg_hash.h" +#include "../configuration.h" +#include "../verbosity.h" + +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if (_MSC_VER >= 1700) +/* https://support.microsoft.com/en-us/kb/980263 */ +#pragma execution_character_set("utf-8") +#endif +#pragma warning(disable:4566) +#endif + +int msg_hash_get_help_hu_enum(enum msg_hash_enums msg, char *s, size_t len) +{ + int ret = 0; + + switch (msg) + { + case MSG_UNKNOWN: + default: + ret = -1; + break; + } + + return ret; +} + +const char *msg_hash_to_str_hu(enum msg_hash_enums msg) +{ + switch (msg) + { +#include "msg_hash_hu.h" + default: + break; + } + + return "null"; +} diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 78c0ee7498..4bd3f2f0c7 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -290,6 +290,7 @@ enum retro_language RETRO_LANGUAGE_CATALAN_VALENCIA = 28, RETRO_LANGUAGE_CATALAN = 29, RETRO_LANGUAGE_BRITISH_ENGLISH = 30, + RETRO_LANGUAGE_HUNGARIAN = 31, RETRO_LANGUAGE_LAST, /* Ensure sizeof(enum) == sizeof(int) */ diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 7e87d2f9b4..9cb5ec980e 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -1548,10 +1548,10 @@ static bool rgui_fonts_init(rgui_t *rgui) case RETRO_LANGUAGE_TURKISH: case RETRO_LANGUAGE_SLOVAK: case RETRO_LANGUAGE_CZECH: + case RETRO_LANGUAGE_HUNGARIAN: /* These languages are not yet implemented case RETRO_LANGUAGE_ROMANIAN: case RETRO_LANGUAGE_CROATIAN: - case RETRO_LANGUAGE_HUNGARIAN: case RETRO_LANGUAGE_SERBIAN: case RETRO_LANGUAGE_WELSH: */ @@ -4214,6 +4214,7 @@ static void rgui_set_blit_functions(unsigned language, case RETRO_LANGUAGE_TURKISH: case RETRO_LANGUAGE_SLOVAK: case RETRO_LANGUAGE_CZECH: + case RETRO_LANGUAGE_HUNGARIAN: blit_line = blit_line_6x10_shadow; break; default: @@ -4251,6 +4252,7 @@ static void rgui_set_blit_functions(unsigned language, case RETRO_LANGUAGE_TURKISH: case RETRO_LANGUAGE_SLOVAK: case RETRO_LANGUAGE_CZECH: + case RETRO_LANGUAGE_HUNGARIAN: blit_line = blit_line_6x10; break; default: diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 999d6b5038..a436046222 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6845,6 +6845,7 @@ static void setting_get_string_representation_uint_user_language( modes[RETRO_LANGUAGE_CATALAN_VALENCIA] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CATALAN_VALENCIA); modes[RETRO_LANGUAGE_CATALAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_CATALAN); modes[RETRO_LANGUAGE_BRITISH_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_BRITISH_ENGLISH); + modes[RETRO_LANGUAGE_HUNGARIAN] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_HUNGARIAN); strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len); } #endif diff --git a/msg_hash.c b/msg_hash.c index 126ea24ad2..ac48ee6030 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -124,6 +124,9 @@ int msg_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len) case RETRO_LANGUAGE_BRITISH_ENGLISH: ret = msg_hash_get_help_en_enum(msg, s, len); break; + case RETRO_LANGUAGE_HUNGARIAN: + ret = msg_hash_get_help_hu_enum(msg, s, len); + break; default: break; } @@ -211,6 +214,8 @@ const char *get_user_language_iso639_1(bool limit) if (limit) return "en"; return "en_gb"; + case RETRO_LANGUAGE_HUNGARIAN: + return "hu"; } return "en"; } @@ -312,6 +317,9 @@ const char *msg_hash_to_str(enum msg_hash_enums msg) case RETRO_LANGUAGE_BRITISH_ENGLISH: ret = msg_hash_to_str_en(msg); break; + case RETRO_LANGUAGE_HUNGARIAN: + ret = msg_hash_to_str_hu(msg); + break; default: break; } diff --git a/msg_hash.h b/msg_hash.h index 6ca2a66c3a..d15468e21f 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3644,6 +3644,9 @@ int msg_hash_get_help_ca_enum(enum msg_hash_enums msg, char *s, size_t len); const char *msg_hash_to_str_en(enum msg_hash_enums msg); int msg_hash_get_help_en_enum(enum msg_hash_enums msg, char *s, size_t len); +const char *msg_hash_to_str_hu(enum msg_hash_enums msg); +int msg_hash_get_help_hu_enum(enum msg_hash_enums msg, char *s, size_t len); + int msg_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len); enum msg_file_type msg_hash_to_file_type(uint32_t hash); diff --git a/retroarch.c b/retroarch.c index 1b04cf1088..4dd6026258 100644 --- a/retroarch.c +++ b/retroarch.c @@ -6279,6 +6279,7 @@ enum retro_language rarch_get_language_from_iso(const char *iso639) {"ca_valencia", RETRO_LANGUAGE_CATALAN_VALENCIA}, {"ca", RETRO_LANGUAGE_CATALAN}, {"en_GB", RETRO_LANGUAGE_BRITISH_ENGLISH}, + {"hu", RETRO_LANGUAGE_HUNGARIAN}, }; if (string_is_empty(iso639))