Add Castellano language, fix some default language detection (#6547)

Closes #6530 
Language file provided by Francisco Lorés and Javier Bartol
This commit is contained in:
Lawrence37 2022-08-26 01:44:22 -07:00 committed by GitHub
parent efbcebb522
commit dfede05312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4142 additions and 15 deletions

View File

@ -63,6 +63,7 @@ Other contributors (profiles, ideas, mockups, testing, forum activity, translati
Lebarhon Lebarhon
Karl Loncarek Karl Loncarek
Patrick Lopatto Patrick Lopatto
Francisco Lorés
Jie Luo Jie Luo
Paul Matthijsse Paul Matthijsse
Wim ter Meer Wim ter Meer

File diff suppressed because it is too large Load Diff

View File

@ -44,33 +44,34 @@ struct LocaleToLang : private std::map<std::pair<Glib::ustring, Glib::ustring>,
emplace (key ("ca", "ES"), "Catala"); emplace (key ("ca", "ES"), "Catala");
emplace (key ("cs", "CZ"), "Czech"); emplace (key ("cs", "CZ"), "Czech");
emplace (key ("da", "DK"), "Dansk"); emplace (key ("da", "DK"), "Dansk");
emplace (key ("de", "DE"), "Deutsch"); emplace (key ("de", "" ), "Deutsch");
#ifdef __APPLE__ #ifdef __APPLE__
emplace (key ("en", "UK"), "English (UK)"); emplace (key ("en", "UK"), "English (UK)");
#else #else
emplace (key ("en", "GB"), "English (UK)"); emplace (key ("en", "GB"), "English (UK)");
#endif #endif
emplace (key ("en", "US"), "English (US)"); emplace (key ("en", "US"), "English (US)");
emplace (key ("es", "ES"), "Espanol"); emplace (key ("es", "" ), "Espanol (Latin America)");
emplace (key ("es", "ES"), "Espanol (Castellano)");
emplace (key ("eu", "ES"), "Euskara"); emplace (key ("eu", "ES"), "Euskara");
emplace (key ("fr", "FR"), "Francais"); emplace (key ("fr", "" ), "Francais");
emplace (key ("el", "GR"), "Greek"); emplace (key ("el", "GR"), "Greek");
emplace (key ("he", "IL"), "Hebrew"); emplace (key ("he", "IL"), "Hebrew");
emplace (key ("it", "IT"), "Italiano"); emplace (key ("it", "" ), "Italiano");
emplace (key ("ja", "JP"), "Japanese"); emplace (key ("ja", "JP"), "Japanese");
emplace (key ("lv", "LV"), "Latvian"); emplace (key ("lv", "" ), "Latvian");
emplace (key ("hu", "HU"), "Magyar"); emplace (key ("hu", "" ), "Magyar");
emplace (key ("nl", "NL"), "Nederlands"); emplace (key ("nl", "" ), "Nederlands");
emplace (key ("nn", "NO"), "Norsk BM"); emplace (key ("nn", "NO"), "Norsk BM");
emplace (key ("nb", "NO"), "Norsk BM"); emplace (key ("nb", "NO"), "Norsk BM");
emplace (key ("pl", "PL"), "Polish"); emplace (key ("pl", "" ), "Polish");
emplace (key ("pt", "PT"), "Portugues (Brasil)"); emplace (key ("pt", "" ), "Portugues (Brasil)");
emplace (key ("ru", "RU"), "Russian"); emplace (key ("ru", "" ), "Russian");
emplace (key ("sr", "RS"), "Serbian (Cyrilic Characters)"); emplace (key ("sr", "RS"), "Serbian (Cyrilic Characters)");
emplace (key ("sk", "SK"), "Slovak"); emplace (key ("sk", "" ), "Slovak");
emplace (key ("fi", "FI"), "Suomi"); emplace (key ("fi", "" ), "Suomi");
emplace (key ("sv", "SE"), "Swedish"); emplace (key ("sv", "SE"), "Swedish");
emplace (key ("tr", "TR"), "Turkish"); emplace (key ("tr", "" ), "Turkish");
emplace (key ("zh", "CN"), "Chinese (Simplified)"); emplace (key ("zh", "CN"), "Chinese (Simplified)");
emplace (key ("zh", "SG"), "Chinese (Traditional)"); emplace (key ("zh", "SG"), "Chinese (Traditional)");
} }
@ -79,12 +80,15 @@ struct LocaleToLang : private std::map<std::pair<Glib::ustring, Glib::ustring>,
{ {
Glib::ustring major, minor; Glib::ustring major, minor;
// TODO: Support 3 character language code when needed.
if (locale.length () >= 2) { if (locale.length () >= 2) {
major = locale.substr (0, 2).lowercase (); major = locale.substr (0, 2).lowercase ();
} }
if (locale.length () >= 5) { if (locale.length () >= 5) {
minor = locale.substr (3, 2).uppercase (); const Glib::ustring::size_type length =
locale.length() > 5 && g_unichar_isalnum(locale[5]) ? 3 : 2;
minor = locale.substr (3, length).uppercase ();
} }
// Look for matching language and country. // Look for matching language and country.
@ -95,7 +99,7 @@ struct LocaleToLang : private std::map<std::pair<Glib::ustring, Glib::ustring>,
} }
// Look for matching language only. // Look for matching language only.
iterator = find (key (major, major.uppercase())); iterator = find (key (major, ""));
if (iterator != end ()) { if (iterator != end ()) {
return iterator->second; return iterator->second;

View File

@ -773,6 +773,9 @@ void Options::readFromFile(Glib::ustring fname)
if (keyFile.has_key("General", "Language")) { if (keyFile.has_key("General", "Language")) {
language = keyFile.get_string("General", "Language"); language = keyFile.get_string("General", "Language");
if (!language.compare("Espanol")) {
language = "Espanol (Latin America)";
}
} }
if (keyFile.has_key("General", "LanguageAutoDetect")) { if (keyFile.has_key("General", "LanguageAutoDetect")) {