commit after pool from trunk and revert to my latest step 2 languages

This commit is contained in:
askvortsov
2010-09-16 18:38:57 -07:00
parent 58c887a445
commit faa3c80bd3
89 changed files with 23159 additions and 18257 deletions

View File

@@ -40,6 +40,7 @@ void Options::setDefaults () {
windowWidth = 1000;
windowHeight = 600;
windowMaximized = false;
firstRun = true;
savesParamsAtExit = true;
saveFormat.format = "jpg";
@@ -60,8 +61,8 @@ void Options::setDefaults () {
profilePath = "profiles";
dirBrowserWidth = 200;
dirBrowserHeight = 150;
toolPanelWidth = 250;
browserToolPanelWidth = 250;
toolPanelWidth = 300;
browserToolPanelWidth = 300;
historyPanelWidth = 150;
lastScale = 4;
lastCropSize = 1;
@@ -243,14 +244,15 @@ if (keyFile.has_group ("Clipping Indication")) {
}
if (keyFile.has_group ("GUI")) {
if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth");
if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight");
if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth");
if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight");
if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth");
if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight");
if (keyFile.has_key ("GUI", "ToolPanelWidth")) toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth");
if (keyFile.has_key ("GUI", "BrowserToolPanelWidth"))browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth");
if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth");
if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight");
if (keyFile.has_key ("GUI", "WindowMaximized")) windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized");
if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth");
if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight");
if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth");
if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight");
if (keyFile.has_key ("GUI", "ToolPanelWidth")) toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth");
if (keyFile.has_key ("GUI", "BrowserToolPanelWidth"))browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth");
if (keyFile.has_key ("GUI", "HistoryPanelWidth")) historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth");
if (keyFile.has_key ("GUI", "LastPreviewScale")) lastScale = keyFile.get_integer ("GUI", "LastPreviewScale");
if (keyFile.has_key ("GUI", "LastCropSize")) lastCropSize = keyFile.get_integer ("GUI", "LastCropSize");
@@ -374,6 +376,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer ("GUI", "WindowWidth", windowWidth);
keyFile.set_integer ("GUI", "WindowHeight", windowHeight);
keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized);
keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth);
keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight);
keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth);
@@ -447,13 +450,38 @@ void Options::load () {
#endif
}
Glib::ustring fname = argv0+"/languages/";
fname += (options.language.empty())? DefaultLanguage : options.language;
if (!langMgr.load (fname, new MultiLangMgr (argv0+"/languages/"+DefaultLanguage)))
langMgr.load (argv0+"/languages/"+DefaultLanguage);
//We handle languages using a hierarchy of translations. The top of the hierarchy is default. This includes a default translation for all items
// (most likely using simple English). The next level is the language: for instance, English, French, Chinese, etc. This file should contain a
// generic translation for all items which differ from default. Finally there is the locale. This is region-specific items which differ from the
// language file. These files must be name in the format <Language> (<LC>), where Language is the name of the language which it inherits from,
// and LC is the locale code. Some examples of this would be English (US) (American English), French (FR) (Franch French), French (CA) (Canadian
// French), etc.
//
// Each level will only contain the differences between itself and its parent translation. For instance, English (UK) or English (CA) may
// include the translation "HISTORY_MSG_34;Avoid Colour Clipping" where English would translate it as "HISTORY_MSG_34;Avoid Color Clipping" (note
// the difference in the spelling of 'colour').
//
// It is important that when naming the translation files, that you stick to the format <Language> or <Language> (<LC>). We depend on that to figure
// out which are the parent translations. Furthermore, there must be a file <Language> for each locale <Language> (<LC>) -- you cannot have
// 'French (CA)' unless there is a file 'French'.
rtengine::init (&options.rtSettings);
Glib::ustring defaultTranslation = argv0 + "/languages/default";
Glib::ustring languageTranslation = "";
Glib::ustring localeTranslation = "";
if (!options.language.empty()){
std::vector<Glib::ustring> langPortions = Glib::Regex::split_simple(" ", options.language);
if (langPortions.size() >= 1){
languageTranslation = argv0 + "/languages/" + langPortions.at(0);
}
if (langPortions.size() >= 2){
localeTranslation = argv0 + "/languages/" + options.language;
}
}
langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation)));
rtengine::init (&options.rtSettings);
}
void Options::save () {