Skip to content

Commit d982611

Browse files
committed
- Don't auto-detect incomplete translations
- Update language name list
1 parent b008e31 commit d982611

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎src/Engine/Game.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,15 +571,15 @@ void Game::loadLanguages()
571571
std::string lang = locale.substr(0, locale.find_first_of('-'));
572572
// Try to load full locale
573573
Unicode::replace(path, defaultLang, locale);
574-
if (CrossPlatform::fileExists(path))
574+
if (Language::isSupported(locale) && CrossPlatform::fileExists(path))
575575
{
576576
currentLang = locale;
577577
}
578578
else
579579
{
580580
// Try to load language locale
581581
Unicode::replace(path, locale, lang);
582-
if (CrossPlatform::fileExists(path))
582+
if (Language::isSupported(lang) && CrossPlatform::fileExists(path))
583583
{
584584
currentLang = lang;
585585
}

‎src/Engine/Language.cpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ Language::Language() : _handler(0), _direction(DIRECTION_LTR), _wrap(WRAP_WORDS)
4646
{
4747
_names["en-US"] = "English (US)";
4848
_names["en-GB"] = "English (UK)";
49+
// _names["ar"] = "العربية"; needs fonts
4950
_names["bg"] = "Български";
51+
_names["ca-ES"] = "Català";
5052
_names["cs"] = "Česky";
5153
_names["cy"] = "Cymraeg";
5254
_names["da"] = "Dansk";
@@ -58,9 +60,11 @@ Language::Language() : _handler(0), _direction(DIRECTION_LTR), _wrap(WRAP_WORDS)
5860
_names["fr"] = "Français (FR)";
5961
_names["fr-CA"] = "Français (CA)";
6062
_names["fi"] = "Suomi";
63+
_names["ga"] = "Gaeilge";
6164
_names["hr"] = "Hrvatski";
6265
_names["hu"] = "Magyar";
6366
_names["it"] = "Italiano";
67+
_names["is"] = "Íslenska";
6468
_names["ja"] = "日本語";
6569
_names["ko"] = "한국어";
6670
_names["lb"] = "Lëtzebuergesch";
@@ -75,9 +79,10 @@ Language::Language() : _handler(0), _direction(DIRECTION_LTR), _wrap(WRAP_WORDS)
7579
_names["sk"] = "Slovenčina";
7680
_names["sl"] = "Slovenščina";
7781
_names["sv"] = "Svenska";
78-
_names["th"] = "ไทย";
82+
// _names["th"] = "ไทย"; needs fonts
7983
_names["tr"] = "Türkçe";
8084
_names["uk"] = "Українська";
85+
_names["vi"] = "Tiếng Việt";
8186
_names["zh-CN"] = "中文";
8287
_names["zh-TW"] = "文言";
8388
}

‎src/Engine/Language.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class Language
5959
~Language();
6060
/// Gets list of languages in the data directory.
6161
static void getList(std::vector<std::string> &files, std::vector<std::string> &names);
62+
/// Checks if a language is in the supported name list.
63+
static bool isSupported(const std::string& lang) { return _names.find(lang) != _names.end(); }
6264
/// Loads the language from an external file.
6365
void loadFile(const std::string &filename);
6466
/// Loads the language from a ruleset file.

0 commit comments

Comments
 (0)