Fixed problems with non-supported languages.
These language files such as "sco.po" or "jbo.po" weren't ignored on STK side and they were displayed in languages list without a name.
This commit is contained in:
parent
c7060cf0e2
commit
f2a738f3d9
@ -121,7 +121,7 @@ DictionaryManager::get_dictionary(const Language& language)
|
||||
{
|
||||
std::vector<std::string> files = filesystem->open_directory(*p);
|
||||
|
||||
std::string best_filename;
|
||||
std::string best_filename = "";
|
||||
int best_score = 0;
|
||||
|
||||
for(std::vector<std::string>::iterator filename = files.begin(); filename != files.end(); filename++)
|
||||
@ -130,7 +130,7 @@ DictionaryManager::get_dictionary(const Language& language)
|
||||
if (has_suffix(*filename, ".po"))
|
||||
{ // ignore anything that isn't a .po file
|
||||
|
||||
Language po_language = Language::from_env(convertFilename2Language(*filename));
|
||||
Language po_language = Language::from_env(convertFilename2Language(*filename));
|
||||
|
||||
if (!po_language)
|
||||
{
|
||||
@ -194,7 +194,12 @@ DictionaryManager::get_languages()
|
||||
{
|
||||
if (has_suffix(*file, ".po"))
|
||||
{
|
||||
languages.insert(Language::from_env(file->substr(0, file->size()-3)));
|
||||
Language po_language = Language::from_env(file->substr(0, file->size()-3));
|
||||
|
||||
if (po_language)
|
||||
{
|
||||
languages.insert(po_language);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,27 +95,22 @@ wchar_t* utf8_to_wide(const char* input)
|
||||
// ----------------------------------------------------------------------------
|
||||
Translations::Translations() //: m_dictionary_manager("UTF-16")
|
||||
{
|
||||
|
||||
m_dictionary_manager.add_directory(
|
||||
file_manager->getAsset(FileManager::TRANSLATION,""));
|
||||
|
||||
if (g_language_list.size() == 0)
|
||||
{
|
||||
std::set<std::string> flist;
|
||||
file_manager->listFiles(flist,
|
||||
file_manager->getAsset(FileManager::TRANSLATION,""));
|
||||
|
||||
std::set<Language> languages = m_dictionary_manager.get_languages();
|
||||
|
||||
// English is always there but won't be found on file system
|
||||
g_language_list.push_back("en");
|
||||
|
||||
std::set<std::string>::iterator it;
|
||||
for ( it=flist.begin() ; it != flist.end(); it++ )
|
||||
|
||||
std::set<Language>::iterator it;
|
||||
for (it = languages.begin(); it != languages.end(); it++)
|
||||
{
|
||||
if (StringUtils::hasSuffix(*it, "po"))
|
||||
{
|
||||
g_language_list.push_back
|
||||
(m_dictionary_manager.convertFilename2Language(*it) );
|
||||
// printf("Lang : <%s>\n", (*it).c_str());
|
||||
}
|
||||
} // for it in flist
|
||||
} // if (g_language_list.size() == 0)
|
||||
g_language_list.push_back((*it).str());
|
||||
}
|
||||
}
|
||||
|
||||
// LC_ALL does not work, sscanf will then not always be able
|
||||
// to scan for example: s=-1.1,-2.3,-3.3 correctly, which is
|
||||
@ -149,9 +144,6 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
|
||||
textdomain (PACKAGE);
|
||||
*/
|
||||
|
||||
m_dictionary_manager.add_directory(
|
||||
file_manager->getAsset(FileManager::TRANSLATION,""));
|
||||
|
||||
/*
|
||||
const std::set<Language>& languages = m_dictionary_manager.get_languages();
|
||||
Log::info("Translatings", "Number of languages: %d", languages.size());
|
||||
|
Loading…
Reference in New Issue
Block a user