From a7a416fa88f16eaf170dbb3e133ffdf55a973d0a Mon Sep 17 00:00:00 2001 From: The Dax Date: Wed, 25 Sep 2013 17:17:17 -0400 Subject: [PATCH] Pull language names from langregion.ini. --- Core/Dialog/PSPOskDialog.cpp | 15 ++++++++++++++- Core/Dialog/PSPOskDialog.h | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 3e8ccb10ab..53cb7c802c 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -36,6 +36,10 @@ #include #endif +extern std::map> GetLangValuesMapping(); + +static std::map> languageMapping; + const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12, 12, 12}; const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4, 4, 4}; @@ -273,6 +277,8 @@ int PSPOskDialog::Init(u32 oskPtr) inputChars += c; } + languageMapping = GetLangValuesMapping(); + // Eat any keys pressed before the dialog inited. __CtrlReadLatch(); @@ -886,7 +892,14 @@ int PSPOskDialog::Update() PPGeDrawText(d->T("Shift"), 240, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("R"), 300, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); - PPGeDrawText(d->T(OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str()), 315, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); + + const char *countryCode = OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str(); + const char *language = languageMapping[countryCode].first.c_str(); + + if (!strcmp(countryCode, "English Full-width")) + language = "English Full-width"; + + PPGeDrawText(language, 315, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); if (IsButtonPressed(CTRL_UP)) { diff --git a/Core/Dialog/PSPOskDialog.h b/Core/Dialog/PSPOskDialog.h index 794626a4ee..13b1717915 100644 --- a/Core/Dialog/PSPOskDialog.h +++ b/Core/Dialog/PSPOskDialog.h @@ -193,10 +193,10 @@ const OskKeyboardDisplay OskKeyboardCases[OSK_LANGUAGE_COUNT][2] = static const std::string OskKeyboardNames[] = { - "English", - "Japanese", - "Korean", - "Russian", + "en_US", + "ja_JP", + "ko_KR", + "ru_RU", "English Full-width", };