diff options
| author | Eugene Sandulenko | 2011-08-20 12:05:20 +0100 | 
|---|---|---|
| committer | Eugene Sandulenko | 2011-08-20 12:52:29 +0100 | 
| commit | 2585de56b62ee3a4bd73cd0e9c061db32c277af4 (patch) | |
| tree | 2f8abe3a61680284dcf0a77bdf62e97a04d66d5d | |
| parent | 4a7616c36634464ff7378df787137ecf2d44d9c4 (diff) | |
| download | scummvm-rg350-2585de56b62ee3a4bd73cd0e9c061db32c277af4.tar.gz scummvm-rg350-2585de56b62ee3a4bd73cd0e9c061db32c277af4.tar.bz2 scummvm-rg350-2585de56b62ee3a4bd73cd0e9c061db32c277af4.zip  | |
COMMON: Restore locale <-> Common::Language conversion utils
This reverts commit 284b49aabc54590e1444f06561a815c2a3c5de7e.
| -rw-r--r-- | common/util.cpp | 54 | ||||
| -rw-r--r-- | common/util.h | 8 | 
2 files changed, 30 insertions, 32 deletions
diff --git a/common/util.cpp b/common/util.cpp index 6bde6a6555..7f28dfa7fe 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -104,29 +104,29 @@ bool parseBool(const String &val, bool &valAsBool) {  const LanguageDescription g_languages[] = { -	{ "zh-cn"/*, "zh_CN"*/, "Chinese (China)", ZH_CNA }, -	{    "zh"/*, "zh_TW"*/, "Chinese (Taiwan)", ZH_TWN }, -	{    "cz"/*, "cs_CZ"*/, "Czech", CZ_CZE }, -	{    "nl"/*, "nl_NL"*/, "Dutch", NL_NLD }, -	{    "en"/*,    "en"*/, "English", EN_ANY }, // Generic English (when only one game version exist) -	{    "gb"/*, "en_GB"*/, "English (GB)", EN_GRB }, -	{    "us"/*, "en_US"*/, "English (US)", EN_USA }, -	{    "fr"/*, "fr_FR"*/, "French", FR_FRA }, -	{    "de"/*, "de_DE"*/, "German", DE_DEU }, -	{    "gr"/*, "el_GR"*/, "Greek", GR_GRE }, -	{    "he"/*, "he_IL"*/, "Hebrew", HE_ISR }, -	{    "hb"/*, "he_IL"*/, "Hebrew", HE_ISR }, // Deprecated -	{    "hu"/*, "hu_HU"*/, "Hungarian", HU_HUN }, -	{    "it"/*, "it_IT"*/, "Italian", IT_ITA }, -	{    "jp"/*, "ja_JP"*/, "Japanese", JA_JPN }, -	{    "kr"/*, "ko_KR"*/, "Korean", KO_KOR }, -	{    "nb"/*, "nb_NO"*/, "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale -	{    "pl"/*, "pl_PL"*/, "Polish", PL_POL }, -	{    "br"/*, "pt_BR"*/, "Portuguese", PT_BRA }, -	{    "ru"/*, "ru_RU"*/, "Russian", RU_RUS }, -	{    "es"/*, "es_ES"*/, "Spanish", ES_ESP }, -	{    "se"/*, "sv_SE"*/, "Swedish", SE_SWE }, -	{       0/*,       0*/, 0, UNK_LANG } +	{ "zh-cn", "zh_CN", "Chinese (China)", ZH_CNA }, +	{    "zh", "zh_TW", "Chinese (Taiwan)", ZH_TWN }, +	{    "cz", "cs_CZ", "Czech", CZ_CZE }, +	{    "nl", "nl_NL", "Dutch", NL_NLD }, +	{    "en",    "en", "English", EN_ANY }, // Generic English (when only one game version exist) +	{    "gb", "en_GB", "English (GB)", EN_GRB }, +	{    "us", "en_US", "English (US)", EN_USA }, +	{    "fr", "fr_FR", "French", FR_FRA }, +	{    "de", "de_DE", "German", DE_DEU }, +	{    "gr", "el_GR", "Greek", GR_GRE }, +	{    "he", "he_IL", "Hebrew", HE_ISR }, +	{    "hb", "he_IL", "Hebrew", HE_ISR }, // Deprecated +	{    "hu", "hu_HU", "Hungarian", HU_HUN }, +	{    "it", "it_IT", "Italian", IT_ITA }, +	{    "jp", "ja_JP", "Japanese", JA_JPN }, +	{    "kr", "ko_KR", "Korean", KO_KOR }, +	{    "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale +	{    "pl", "pl_PL", "Polish", PL_POL }, +	{    "br", "pt_BR", "Portuguese", PT_BRA }, +	{    "ru", "ru_RU", "Russian", RU_RUS }, +	{    "es", "es_ES", "Spanish", ES_ESP }, +	{    "se", "sv_SE", "Swedish", SE_SWE }, +	{       0,       0, 0, UNK_LANG }  };  Language parseLanguage(const String &str) { @@ -142,7 +142,7 @@ Language parseLanguage(const String &str) {  	return UNK_LANG;  } -/*Language parseLanguageFromLocale(const char *locale) { +Language parseLanguageFromLocale(const char *locale) {  	if (!locale || !*locale)  		return UNK_LANG; @@ -153,7 +153,7 @@ Language parseLanguage(const String &str) {  	}  	return UNK_LANG; -}*/ +}  const char *getLanguageCode(Language id) {  	const LanguageDescription *l = g_languages; @@ -164,14 +164,14 @@ const char *getLanguageCode(Language id) {  	return 0;  } -/*const char *getLanguageLocale(Language id) { +const char *getLanguageLocale(Language id) {  	const LanguageDescription *l = g_languages;  	for (; l->code; ++l) {  		if (l->id == id)  			return l->unixLocale;  	}  	return 0; -}*/ +}  const char *getLanguageDescription(Language id) {  	const LanguageDescription *l = g_languages; diff --git a/common/util.h b/common/util.h index a96c7a60c6..bccb17c6da 100644 --- a/common/util.h +++ b/common/util.h @@ -134,7 +134,7 @@ enum Language {  struct LanguageDescription {  	const char *code; -	//const char *unixLocale; +	const char *unixLocale;  	const char *description;  	Language id;  }; @@ -144,13 +144,11 @@ extern const LanguageDescription g_languages[];  /** Convert a string containing a language name into a Language enum value. */  extern Language parseLanguage(const String &str); +extern Language parseLanguageFromLocale(const char *locale);  extern const char *getLanguageCode(Language id); +extern const char *getLanguageLocale(Language id);  extern const char *getLanguageDescription(Language id); -// locale <-> Language conversion is disabled, since it is not used currently -/*extern const char *getLanguageLocale(Language id); -extern Language parseLanguageFromLocale(const char *locale);*/ -  /**   * List of game platforms. Specifying a platform for a target can be used to   * give the game engines a hint for which platform the game data file are.  | 
