changed: removed Languages::Land enum
now we set the languages in the config file: option locale_files, sample: locale_files = ( en, pl ) it represents the name of locale files (those from locale_dir directory) renamed config option: locale to locale_default git-svn-id: svn://ttmath.org/publicrep/winix/trunk@722 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ Ezc::Pattern * content_for_function()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const size_t loc_index = static_cast<size_t>(locale.GetLang());
|
||||
const size_t loc_index = locale.GetLang();
|
||||
const size_t fun_id = static_cast<size_t>(cur->request->function->id);
|
||||
|
||||
if( loc_index >= patterns_fun.size() || fun_id >= patterns_fun[loc_index].size() )
|
||||
@@ -72,7 +72,7 @@ void content(Info & i)
|
||||
{
|
||||
Ezc::Pattern * p = 0;
|
||||
|
||||
if( static_cast<size_t>(locale.GetLang()) >= patterns.size() )
|
||||
if( locale.GetLang() >= patterns.size() )
|
||||
{
|
||||
log << log1 << "Templates: there is no such a language in patterns" << logend;
|
||||
return;
|
||||
@@ -464,14 +464,11 @@ void Templates::SetLocale()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
Locale::Lang lang = Locale::StrToLang(config->locale_str);
|
||||
|
||||
if( lang != Locale::lang_unknown )
|
||||
locale.SetLang(lang);
|
||||
else
|
||||
locale.SetLang(Locale::lang_en);
|
||||
|
||||
locale.UTF8(config->utf8);
|
||||
locale.SetLocaleFiles(config->locale_files);
|
||||
// !! tutaj nie potrzeba ustawiac locali SetLang/SetLangDef (nie odczytujemy kluczy)
|
||||
locale.SetLang(config->locale_default_index); // !! w przyszlosci locale beda ustawiane dla kazdego uzytkownika osobno
|
||||
locale.SetLangDef(config->locale_default_index);
|
||||
locale.Read(config->locale_dir, config->locale_dir_default);
|
||||
}
|
||||
|
||||
@@ -575,13 +572,31 @@ using namespace TemplatesFunctions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Templates::ClearPatterns(TemplatesFunctions::Patterns & patterns, size_t len)
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
size_t loc, pat;
|
||||
|
||||
patterns.resize(locale.Size());
|
||||
|
||||
for(loc=0 ; loc < patterns.size() ; ++loc)
|
||||
{
|
||||
patterns[loc].resize(len);
|
||||
|
||||
for(pat=0 ; pat<len ; ++pat)
|
||||
patterns[loc][pat].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// index_patterns and patterns for items are not cleared here
|
||||
void Templates::ClearPatterns()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
TemplatesFunctions::ClearPatterns(patterns, pat_last);
|
||||
TemplatesFunctions::ClearPatterns(patterns_fun, functions->FunctionsSize());
|
||||
ClearPatterns(patterns, pat_last);
|
||||
ClearPatterns(patterns_fun, functions->FunctionsSize());
|
||||
}
|
||||
|
||||
|
||||
@@ -590,7 +605,7 @@ void Templates::Generate()
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
// !! locale beda w zaleznosci od uzytkownika
|
||||
if( static_cast<size_t>(locale.GetLang()) >= patterns.size() )
|
||||
if( locale.GetLang() >= patterns.size() )
|
||||
return;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
|
||||
Reference in New Issue
Block a user