renamed: config option 'html_filter_break_lines' to 'html_filter_break_word'
added: config option 'html_filter_wrap_line' this wraps the whole line (line calculated with html tags as well) changed: orphans (for html filter) are read from locale files now ('language_orphans' value ) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@728 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -17,6 +17,7 @@ Locale::Locale()
|
||||
{
|
||||
locale_files.push_back(L"en");
|
||||
loc_tab.resize(locale_files.size());
|
||||
loc_tab_multi.resize(locale_files.size());
|
||||
|
||||
default_lang = 0;
|
||||
current_lang = 0;
|
||||
@@ -32,6 +33,7 @@ void Locale::SetLocaleFiles(const std::vector<std::wstring> & files)
|
||||
locale_files.push_back(L"en");
|
||||
|
||||
loc_tab.resize(locale_files.size());
|
||||
loc_tab_multi.resize(locale_files.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +88,13 @@ void Locale::AddLocale(size_t lang)
|
||||
|
||||
for( ; i != loc_parser.table_single.end() ; ++i)
|
||||
loc_tab[lang][i->first] = i->second;
|
||||
|
||||
|
||||
// lists
|
||||
ConfParser::Table::iterator i2 = loc_parser.table.begin();
|
||||
|
||||
for( ; i2 != loc_parser.table.end() ; ++i2)
|
||||
loc_tab_multi[lang][i2->first] = i2->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +189,12 @@ void Locale::Read(const std::wstring & dir, const std::wstring & dir_def)
|
||||
}
|
||||
|
||||
|
||||
size_t Locale::Size() const
|
||||
{
|
||||
return loc_tab.size();
|
||||
}
|
||||
|
||||
|
||||
void Locale::SetLang(size_t lang)
|
||||
{
|
||||
current_lang = lang;
|
||||
@@ -260,6 +275,26 @@ bool Locale::IsKey(const std::wstring & key, size_t lang) const
|
||||
}
|
||||
|
||||
|
||||
bool Locale::IsKeyLang(const wchar_t * key, size_t lang)
|
||||
{
|
||||
key_str = key;
|
||||
return IsKeyLang(key_str, lang);
|
||||
}
|
||||
|
||||
|
||||
bool Locale::IsKeyLang(const std::wstring & key, size_t lang) const
|
||||
{
|
||||
if( lang >= loc_tab.size() )
|
||||
return false;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
|
||||
return i != loc_tab[lang].end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::wstring & Locale::Get(const wchar_t * key)
|
||||
{
|
||||
key_str = key;
|
||||
@@ -311,6 +346,61 @@ const std::wstring & Locale::Get(const std::wstring & key, size_t lang) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Locale::IsKeyLangList(const wchar_t * key, size_t lang)
|
||||
{
|
||||
key_str = key;
|
||||
return IsKeyLangList(key_str, lang);
|
||||
}
|
||||
|
||||
|
||||
bool Locale::IsKeyLangList(const std::wstring & key, size_t lang) const
|
||||
{
|
||||
if( lang >= loc_tab_multi.size() )
|
||||
return false;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
|
||||
return i != loc_tab_multi[lang].end();
|
||||
}
|
||||
|
||||
|
||||
const std::vector<std::wstring> & Locale::GetList(const std::wstring & key) const
|
||||
{
|
||||
return GetList(key, current_lang);
|
||||
}
|
||||
|
||||
|
||||
const std::vector<std::wstring> & Locale::GetList(const std::wstring & key, size_t lang) const
|
||||
{
|
||||
if( lang >= loc_tab_multi.size() )
|
||||
return empty_list;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
|
||||
if( i != loc_tab_multi[lang].end() )
|
||||
return i->second;
|
||||
|
||||
if( lang == default_lang )
|
||||
return empty_list;
|
||||
|
||||
|
||||
if( default_lang >= loc_tab_multi.size() )
|
||||
return empty_list;
|
||||
|
||||
// looking in a default language
|
||||
i = loc_tab_multi[default_lang].find(key);
|
||||
|
||||
if( i != loc_tab_multi[default_lang].end() )
|
||||
return i->second;
|
||||
|
||||
// there is no such a key
|
||||
return empty_list;
|
||||
}
|
||||
|
||||
|
||||
size_t Locale::FileNameToLang(const std::wstring & str) const
|
||||
{
|
||||
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
||||
|
Reference in New Issue
Block a user