diff options
| author | LI Daobing <lidaobing@gmail.com> | 2008-12-21 10:40:52 +0800 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-14 11:35:39 +0100 |
| commit | 85631da8f19d36f83b49c02eb603e920494be509 (patch) | |
| tree | be64dde064dd781ed3beeb5f05225470ebca8a17 | |
| parent | cec654a0c8103c4551e7324e28206c9465fc1dae (diff) | |
| download | tuxcmd-85631da8f19d36f83b49c02eb603e920494be509.tar.xz | |
Distinguish between zh_CN and zh_TW
currently only the first 2 character is effect in locale,
so zh_CN and zh_TW will use same translation file. in the algorithm,
for locale zh_CN.UTF-8, will try ZH_CN.UTF-8 first, then ZH_CN, then ZH.
Signed-off-by: Tomas Bzatek <tbzatek@users.sourceforge.net>
| -rw-r--r-- | ULocale.pas | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ULocale.pas b/ULocale.pas index 78ee58e..8f81ecc 100644 --- a/ULocale.pas +++ b/ULocale.pas @@ -302,8 +302,16 @@ begin if Length(Trim(Lang)) = 0 then Lang := GetEnvironmentVariable('LANG'); if Length(Trim(Lang)) = 0 then Lang := 'en_US'; // Default language end else Lang := ForceLocale; - if Length(Trim(Lang)) >= 2 then Lang := AnsiUpperCase(Copy(Lang, 1, 2)); + Lang := Trim(AnsiUpperCase(Lang)); LangIdx := LookupLanguages; + if (LangIdx = -1) and (Length(Lang) > 5) then begin + Lang := Copy(Lang, 1, 5); + LangIdx := LookupLanguages; + end; + if (LangIdx = -1) and (Length(Lang) > 2) then begin + Lang := Copy(Lang, 1, 2); + LangIdx := LookupLanguages; + end; if LangIdx = -1 then begin Lang := 'EN'; LangIdx := LookupLanguages; |
