diff options
author | frosch <frosch@openttd.org> | 2021-04-11 17:28:47 +0200 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2021-04-22 22:16:56 +0200 |
commit | 37222c3fa2f558df5f7ef420ad583ba403ceda62 (patch) | |
tree | c4f322cd2a726e7dccc9a089959aec07b2a0e9f0 /src/strings.cpp | |
parent | a9740cef82b6969be1087bb0cfa2fcfdc3058845 (diff) | |
download | openttd-37222c3fa2f558df5f7ef420ad583ba403ceda62.tar.xz |
Change: treat languages as finished, if translations are 75% completed.
Unfinished translations are not auto-picked from the locale.
In release builds, unfinished translations are not offered in the GUI.
Unfinished translations are available in non-release builds, or by editing openttd.cfg.
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index aeea7c071..d533db1fc 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1717,6 +1717,15 @@ bool LanguagePackHeader::IsValid() const } /** + * Check whether a translation is sufficiently finished to offer it to the public. + */ +bool LanguagePackHeader::IsReasonablyFinished() const +{ + /* "Less than 25% missing" is "sufficiently finished". */ + return 4 * this->missing < LANGUAGE_TOTAL_STRINGS; +} + +/** * Read a particular language. * @param lang The metadata about the language. * @return Whether the loading went okay or not. @@ -1969,6 +1978,10 @@ void InitializeLanguagePacks() } if (strcmp (lng.isocode, "en_GB") == 0) en_GB_fallback = &lng; + + /* Only auto-pick finished translations */ + if (!lng.IsReasonablyFinished()) continue; + if (strncmp(lng.isocode, lang, 5) == 0) chosen_language = &lng; if (strncmp(lng.isocode, lang, 2) == 0) language_fallback = &lng; } |