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.
|
||||
*
|
||||
*/
|
||||
@@ -164,9 +164,10 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
html_filter_orphans_lang_str = AText(L"html_filter_orphans_lang", L"pl");
|
||||
html_filter_orphans_mode_str = AText(L"html_filter_orphans_mode_str", L"nbsp");
|
||||
|
||||
locale_str = Text(L"locale", L"en");
|
||||
locale_dir = Text(L"locale_dir");
|
||||
locale_dir_default = Text(L"locale_dir_default");
|
||||
locale_default = Text(L"locale_default");
|
||||
ListText(L"locale_files", locale_files);
|
||||
|
||||
title_separator = Text(L"title_separator", L" / ");
|
||||
|
||||
@@ -179,7 +180,7 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
|
||||
plugins_dir = Text(L"plugins_dir", L"/usr/local/winix/plugins");
|
||||
NoLastSlash(plugins_dir);
|
||||
parser.ListText(L"plugins", plugin_file);
|
||||
ListText(L"plugins", plugin_file);
|
||||
|
||||
time_zone_offset = Int(L"time_zone_offset", 0);
|
||||
time_zone_offset_guest = Int(L"time_zone_offset_guest", 0);
|
||||
@@ -191,6 +192,9 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Config::SetAdditionalVariables()
|
||||
{
|
||||
SetHttpHost(base_url, base_url_http_host);
|
||||
@@ -210,10 +214,40 @@ void Config::SetAdditionalVariables()
|
||||
html_filter_orphans_mode = HTMLFilter::orphan_160space;
|
||||
else
|
||||
html_filter_orphans_mode = HTMLFilter::orphan_nbsp;
|
||||
|
||||
CheckLocale();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Config::CheckLocale()
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
if( locale_files.empty() )
|
||||
locale_files.push_back(L"en");
|
||||
|
||||
if( locale_default.empty() )
|
||||
locale_default = locale_files[0];
|
||||
|
||||
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
||||
{
|
||||
if( locale_files[i] == locale_default )
|
||||
{
|
||||
locale_default_index = i;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !found )
|
||||
{
|
||||
// we have at least one item
|
||||
locale_default = locale_files[0];
|
||||
locale_default_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Config::SetHttpHost(const std::wstring & in, std::wstring & out)
|
||||
{
|
||||
|
@@ -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.
|
||||
*
|
||||
*/
|
||||
@@ -229,16 +229,24 @@ public:
|
||||
// default: /usr/local/bin/convert
|
||||
std::wstring convert_cmd;
|
||||
|
||||
// locale: en, pl
|
||||
// default: en
|
||||
std::wstring locale_str;
|
||||
|
||||
// directory with locale files
|
||||
std::wstring locale_dir;
|
||||
|
||||
// directory with default locale files (those from winix)
|
||||
std::wstring locale_dir_default;
|
||||
|
||||
// locale files (e.g. "en", "pl")
|
||||
// default: only one item: en
|
||||
std::vector<std::wstring> locale_files;
|
||||
|
||||
// default locale
|
||||
// default: the first item from locale_files
|
||||
std::wstring locale_default;
|
||||
|
||||
// default locale - index to locale_files
|
||||
// not available in config -- set automatically based on locale_default
|
||||
size_t locale_default_index;
|
||||
|
||||
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
|
||||
std::wstring base_server;
|
||||
|
||||
@@ -337,6 +345,7 @@ private:
|
||||
void AssignValues(bool stdout_is_closed);
|
||||
void SetHttpHost(const std::wstring & in, std::wstring & out);
|
||||
void SetAdditionalVariables();
|
||||
void CheckLocale();
|
||||
|
||||
ConfParser parser;
|
||||
|
||||
|
Reference in New Issue
Block a user