X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FMessages.cpp;h=5eee6b7f6d5aa20d29b6d255c6b3adb208ce8cd3;hb=f1ab5dfc5878bc736fd185279a0ef7a185b2d8d8;hp=cceec1539c3b503b994e67522e00e6f9d6d528e0;hpb=2e1c61882409e51bf5747c391a667adf73abc723;p=lyx.git diff --git a/src/support/Messages.cpp b/src/support/Messages.cpp index cceec1539c..5eee6b7f6d 100644 --- a/src/support/Messages.cpp +++ b/src/support/Messages.cpp @@ -112,9 +112,22 @@ string Messages::language() const } -bool Messages::available() const +bool Messages::available(string const & c) { - return !language().empty(); + static string locale_dir = package().locale_dir().toFilesystemEncoding(); + string code = c; + // this loops at most twice + while (true) { + string const filen = locale_dir + "/" + code + + "/LC_MESSAGES/"PACKAGE".mo"; + if (FileName(filen).isReadableFile()) + return true; + if (contains(code, '_')) + code = token(code, '_', 0); + else return false; + } + return false; + } @@ -221,9 +234,14 @@ docstring const Messages::get(string const & m) const return trans; } +std::string Messages::language() const + { + return string(); + } -bool Messages::available() const +bool Messages::available(string const & c) { + (void)c; return false; }