diff options
author | Wengier <wengierwu@yahoo.com> | 2022-09-22 05:47:25 +0300 |
---|---|---|
committer | Wengier <wengierwu@yahoo.com> | 2022-09-24 08:07:27 +0300 |
commit | 818f1b399ca0ec85ccb4cdbcbb5b23ef3d1e88f1 (patch) | |
tree | 8734c0509db2971190b5f7476ddd80a9969be1ed | |
parent | b49bce92e7d051aec7ddaf0417b6a094efdd4bd6 (diff) |
Dutch language file defaults to U.S. keyboard layoutww/nl-default-us
-rw-r--r-- | src/dos/dos_keyboard_layout.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/dos/dos_keyboard_layout.cpp b/src/dos/dos_keyboard_layout.cpp index 177476d67..34d0cd4e2 100644 --- a/src/dos/dos_keyboard_layout.cpp +++ b/src/dos/dos_keyboard_layout.cpp @@ -1347,6 +1347,10 @@ static const std::map<std::string, Country> country_code_map{ // clang-format on }; +static const std::map<std::string, const char *> language_to_layout_exception_map{ + {"nl", "us"}, +}; + static bool country_number_exists(const int requested_number) { for ([[maybe_unused]] const auto &[code, number] : country_code_map) @@ -1367,6 +1371,16 @@ static bool lookup_country_from_code(const char *country_code, Country &country) return false; } +static const char *lookup_language_to_layout_exception(const char *language_code) +{ + if (language_code) { + const auto it = language_to_layout_exception_map.find(language_code); + if (it != language_to_layout_exception_map.end()) + return it->second; + } + return language_code; +} + uint16_t assert_codepage(const uint16_t codepage) { assert(!sv{get_builtin_cp_filename(codepage)}.empty()); @@ -1640,7 +1654,8 @@ KeyboardErrorCode DOS_LoadKeyboardLayoutFromLanguage(const char * language_pref) } // Regardless of the above, carry on with setting up the layout const auto codepage = lookup_codepage_from_country(country); - const auto result = DOS_LoadKeyboardLayout(language.c_str(), codepage, "auto"); + const auto layout = lookup_language_to_layout_exception(language.c_str()); + const auto result = DOS_LoadKeyboardLayout(layout, codepage, "auto"); if (result == KEYB_NOERROR) { LOG_MSG("LAYOUT: Loaded codepage %d for detected language %s", codepage, language.c_str()); |