/*
Some english words have different translations, depending on
context. In these cases the original string is augmented by
- context information (e.g. "To:[[[as in 'From page x to page
+ context information (e.g. "To:[[as in 'From page x to page
y']]" and "To:[[as in 'From format x to format y']]". This
means that we need to filter out everything in double square
brackets at the end of the string, otherwise the user sees
}
-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;
+
}
return trans;
}
+std::string Messages::language() const
+ {
+ return string();
+ }
-bool Messages::available() const
+bool Messages::available(string const & c)
{
+ (void)c;
return false;
}