Merge pull request #1958 from Prcuvu/split_zh_language

Split Chinese language into two different locales based on Simplified or Traditional script
This commit is contained in:
quietly-turning
2020-02-13 14:40:35 -05:00
committed by GitHub
13 changed files with 58 additions and 14 deletions
+2 -1
View File
@@ -2594,7 +2594,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -1
View File
@@ -2645,7 +2645,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -1
View File
@@ -2564,7 +2564,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -1
View File
@@ -2576,7 +2576,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -1
View File
@@ -2785,7 +2785,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
+2 -1
View File
@@ -2576,7 +2576,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -1
View File
@@ -2551,7 +2551,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
@@ -2622,7 +2622,8 @@ Wolof=Wolof
Xhosa=isiXhosa
Yiddish=Yiddish
Yoruba=Yorùbá
Chinese=中文
Chinese (Simplified)=简体中文
Chinese (Traditional)=繁體中文
Zulu=isiZulu
[ScreenPlayerOptions]
+2 -2
View File
@@ -547,7 +547,6 @@ RString ConvertI64FormatString( const RString &sStr ) { return sStr; }
#endif
/* ISO-639-1 codes: http://www.loc.gov/standards/iso639-2/php/code_list.php
* native forms: http://people.w3.org/rishida/names/languages.html
* We don't use 3-letter codes, so we don't bother supporting them. */
static const LanguageInfo g_langs[] =
{
@@ -688,7 +687,8 @@ static const LanguageInfo g_langs[] =
{"xh", "Xhosa"},
{"yi", "Yiddish"},
{"yo", "Yoruba"},
{"zh", "Chinese"},
{"zh-Hans", "Chinese (Simplified)"},
{"zh-Hant", "Chinese (Traditional)"},
{"zu", "Zulu"},
};
+7
View File
@@ -261,7 +261,14 @@ RString ArchHooks::GetPreferredLanguage()
// MacRoman agrees with ASCII in the low-order 7 bits.
const char *str = CFStringGetCStringPtr( lang, kCFStringEncodingMacRoman );
if( str )
{
ret = RString( str, 2 );
if (ret == "zh")
{
ret = RString(str, 7);
ret[2] = '-';
}
}
else
LOG->Warn( "Unable to determine system language. Using English." );
}
+18 -2
View File
@@ -179,13 +179,29 @@ RString ArchHooks::GetPreferredLanguage()
{
RString locale;
if(getenv("LANG"))
if (getenv("LANG"))
{
locale = getenv("LANG");
locale = locale.substr(0,2);
RString region = locale.substr(3, 2);
locale = locale.substr(0, 2);
if (locale == "zh")
{
if (region == "CN" || region == "SG")
{
locale = "zh-Hans";
}
else if (region == "HK" || region == "TW")
{
locale = "zh-Hant";
}
}
}
else
{
LOG->Warn("Unable to determine system language. Using English.");
locale = "en";
}
return locale;
}
+15 -2
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "ArchHooks.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "archutils/Win32/SpecialDirs.h"
#include "ProductInfo.h"
#include "RageFileManager.h"
@@ -98,7 +99,19 @@ static RString LangIdToString( LANGID l )
case LANG_ARABIC: return "ar";
case LANG_BULGARIAN: return "bg";
case LANG_CATALAN: return "ca";
case LANG_CHINESE: return "zh";
case LANG_CHINESE:
{
switch (SUBLANGID(l))
{
case SUBLANG_CHINESE_TRADITIONAL:
case SUBLANG_CHINESE_HONGKONG:
case SUBLANG_CHINESE_MACAU:
return "zh-Hant";
case SUBLANG_CHINESE_SIMPLIFIED:
case SUBLANG_CHINESE_SINGAPORE:
return "zh-Hans";
}
}
case LANG_CZECH: return "cs";
case LANG_DANISH: return "da";
case LANG_GERMAN: return "de";
@@ -154,7 +167,7 @@ static RString LangIdToString( LANGID l )
// These aren't present in the VC6 headers. We'll never have translations to these languages anyway. -C
//case LANG_MONGOLIAN: return "mn";
//case LANG_GALICIAN: return "gl";
default:
default: LOG->Warn("Unable to determine system language. Using English.");
case LANG_ENGLISH: return "en";
}
}