Browse Source

Translations: Restore support for ".mo" files

Note that they now need to go into the "assets/" subdirectory of the
build directory.
pull/3234/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
3448eab2d3
  1. 13
      Source/utils/language.cpp

13
Source/utils/language.cpp

@ -266,9 +266,16 @@ bool HasTranslation(const std::string &locale)
void LanguageInitialize()
{
std::string filename = sgOptions.Language.szCode;
filename.append(".gmo");
SDL_RWops *rw = SFileOpenRw(filename.c_str());
const std::string lang = sgOptions.Language.szCode;
SDL_RWops *rw;
// Translations normally come in ".gmo" files.
// We also support ".mo" because that is what poedit generates
// and what translators use to test their work.
for (const char *ext : { ".mo", ".gmo" }) {
if ((rw = SFileOpenRw((lang + ext).c_str())) != nullptr)
break;
}
if (rw == nullptr)
return;

Loading…
Cancel
Save