From ac99fe36cfdc0a1f8bc9f688b24e203bfb5bf90d Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 25 Sep 2014 06:20:43 +0000 Subject: [PATCH] Core: SetLanguage(const char *s) git-svn-id: svn://ultimatepp.org/upp/trunk@7723 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/CharSet.cpp | 9 ++++++--- uppsrc/Core/Lang.cpp | 10 ++++++++++ uppsrc/Core/Lang.h | 3 +++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/uppsrc/Core/CharSet.cpp b/uppsrc/Core/CharSet.cpp index 8e178ddc2..ff4a0e94d 100644 --- a/uppsrc/Core/CharSet.cpp +++ b/uppsrc/Core/CharSet.cpp @@ -2128,9 +2128,12 @@ int CharsetByName(const char *name) String nm = Filter(name, cs_filter); if(nm == "utf8" || nm == "utf-8") return CHARSET_UTF8; - for(int i = 1; i < CharsetCount(); i++) - if(nm == Filter(CharsetName(i), cs_filter)) - return i; + for(int pass = 0; pass < 2; pass++) { + for(int i = 1; i < CharsetCount(); i++) + if(nm == Filter(CharsetName(i), cs_filter)) + return i; + nm.Replace("win", "windows"); + } return 0; } diff --git a/uppsrc/Core/Lang.cpp b/uppsrc/Core/Lang.cpp index d936d2c28..2f9d7ed11 100644 --- a/uppsrc/Core/Lang.cpp +++ b/uppsrc/Core/Lang.cpp @@ -154,6 +154,16 @@ void SetLanguage(int lang) { SetCurrentLanguage(lang); } +void SetLanguage(const char *s) +{ + SetLanguage(LNGFromText(s)); +} + +String GetCurrentLanguageString() +{ + return LNGAsText(GetCurrentLanguage()); +} + String GetLangName(int language) { return GetLanguageInfo(language).english_name; diff --git a/uppsrc/Core/Lang.h b/uppsrc/Core/Lang.h index fb11c075f..5cf302b5e 100644 --- a/uppsrc/Core/Lang.h +++ b/uppsrc/Core/Lang.h @@ -21,6 +21,9 @@ int SetLNGCharset(int lng, byte chrset); void SetLanguage(int lang); int GetCurrentLanguage(); +void SetLanguage(const char *s); +String GetCurrentLanguageString(); + int GetSystemLNG(); VectorMap GetLanguage(int lang);//rename...