From 85631da8f19d36f83b49c02eb603e920494be509 Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Sun, 21 Dec 2008 10:40:52 +0800 Subject: 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 --- ULocale.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ULocale.pas') 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; -- cgit v1.2.3