在 setlocale 中使用正确的代码

Using the correct codes with setlocale

我看过 setlocale,但我很难找到我要找的东西。

在我的代码中我有:

void CMeetingScheduleAssistantApp::SetLocale()
{
    CString strLang[NUM_LANGUAGES] =
    {
        _T("eng"), _T("deu"), _T("esp"), _T("ita"),
        _T("plk"), _T("fra"), _T("ptb"), _T("nld"),
        _T("sve"), _T("slv"), _T("csy"), _T("fin"),
        _T("dan"), _T("ukr"), _T("rus"),
        _T("eng"), /*_T("fpo") Tagalog */
        _T("eng"), /* Haitian Creole */
        _T("eng"), /* Afrikaans */
        _T("sqi"),
        _T("chs"), /* Chinese (Simplified) */
        _T("hrv"),
        _T("trk"),
        _T("eng"),  /* Twi */
        _T("swk"),  // AJT v11.3.4
        _T("eng"),  // _T("eti") Estonian AJT v12.0.5
        _T("rom"),  // Romanian AJT v12.0.8
        _T("ell"),  // Greek AJT v13.0.0
        _T("bgr"),  // Bulgarian AJT v13.0.2
        _T("eng"),  // Malagasy AJT v14.0.4
        _T("ara"),  // Arabic AJT v16.0.0
        _T("ind"),  // Indonesian AJT v16.0.2
        _T("hin"),  // Hindi AJT v16.0.7
        _T("tai"),  // Tamil AJT v16.1.0
        _T("vit"),  // Vietnamese v16.1.1
        _T("eng"),  // Zulu AJT v16.1.6
        _T("eng"),  // Gun AJT v17.0.9
        _T("ln-CG"),  // Lingala v17.0.9
        _T("ptg")   // Portuguese Portugal v17.1.0
        // Add more languages here
    };

    _tsetlocale(LC_ALL, strLang[m_eLanguage - LANGUAGE_ENGLISH]);
}

这已经完成并且始终可以正常工作。进行此调用后日期格式正确。

但是查看上述帮助主题提供的链接,我找不到 ptb 等列出的代码。只有 pt-BR.

我假设我的代码仍然有效并且它们在任何地方都有记录?

setlocale expects a locale name as documented under Locale Names, Languages, and Country/Region Strings. A locale can be identified by locale name:

A locale name is based on the language tagging conventions of RFC 4646 (Windows Vista and later), and is represented by LOCALE_SNAME. Generally, the pattern <language>-<REGION> is used. Here, language is a lowercase ISO 639 language code. The codes from ISO 639-1 are used when available. Otherwise, codes from ISO 639-2/T are used.

[...]

If the locale is a neutral locale (no region), the LOCALE_SNAME value follows the pattern <language>.

ISO 639-2 三字母语言代码的完整列表已发布在 wikipedia