summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/Strings.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Strings.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/Strings.js27
1 files changed, 10 insertions, 17 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Strings.js b/frontend/gamma/js/Clipperz/PM/Strings.js
index a051365..7e855ff 100644
--- a/frontend/gamma/js/Clipperz/PM/Strings.js
+++ b/frontend/gamma/js/Clipperz/PM/Strings.js
@@ -1,46 +1,44 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } 26if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
29if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } 27if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; }
30 28
31//----------------------------------------------------------------------------- 29//-----------------------------------------------------------------------------
32/* 30/*
33Clipperz.PM.Strings.standardStrings = { 31Clipperz.PM.Strings.standardStrings = {
34 'loginPanelSwitchLanguageSelectOptions':[ 32 'loginPanelSwitchLanguageSelectOptions':[
35/ * 33/ *
36 {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true}, 34 {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true},
37 {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true}, 35 {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true},
38 {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true}, 36 {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true},
39 {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true}, 37 {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true},
40 {tag:'option', html:"Català", value:'ca-ES', disabled:true}, 38 {tag:'option', html:"Català", value:'ca-ES', disabled:true},
41 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true}, 39 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true},
42 {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true}, 40 {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true},
43 {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true}, 41 {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true},
44 {tag:'option', html:"Dansk", value:'da-DK', disabled:true}, 42 {tag:'option', html:"Dansk", value:'da-DK', disabled:true},
45 {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /}, 43 {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /},
46 {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /}, 44 {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /},
@@ -220,64 +218,59 @@ Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) {
220 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]); 218 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]);
221 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]); 219 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]);
222 220
223 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[selectedLanguage]); 221 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[selectedLanguage]);
224 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]); 222 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]);
225 223
226 Clipperz.PM.Strings.stringsObjectStore = new Clipperz.KeyValueObjectStore(/*{'name':'String.stringsObjectStore [1]'}*/); 224 Clipperz.PM.Strings.stringsObjectStore = new Clipperz.KeyValueObjectStore(/*{'name':'String.stringsObjectStore [1]'}*/);
227 Clipperz.PM.Strings.stringsObjectStore.initWithValues(translations); 225 Clipperz.PM.Strings.stringsObjectStore.initWithValues(translations);
228 226
229 if (typeof(bookmarklet) != 'undefined') { 227 if (typeof(bookmarklet) != 'undefined') {
230 Clipperz.PM.Strings.stringsObjectStore.setValue('bookmarklet', Clipperz.PM.Strings.translateBookmarklet(bookmarklet)); 228 Clipperz.PM.Strings.stringsObjectStore.setValue('bookmarklet', Clipperz.PM.Strings.translateBookmarklet(bookmarklet));
231 } 229 }
232 230
233 MochiKit.Signal.signal(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage); 231 MochiKit.Signal.signal(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage);
234 } 232 }
235} 233}
236 234
237//----------------------------------------------------------------------------- 235//-----------------------------------------------------------------------------
238 236
239Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) { 237Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) {
240 varresult; 238 varresult;
241 239
242 result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath); 240 result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath);
243 241
244//try {
245 if (typeof(result) == 'string') { 242 if (typeof(result) == 'string') {
246 if (typeof (someKeyValues) != 'undefined') { 243 if (typeof (someKeyValues) != 'undefined') {
247 varkey; 244 varkey;
248 245
249 for (key in someKeyValues) { 246 for (key in someKeyValues) {
250 result = result.replace( new RegExp(key), someKeyValues[key]); 247 result = result.replace( new RegExp(key), someKeyValues[key]);
251 // result.replace(, '');
252 } 248 }
253 } 249 }
254 250
255 result = result.replace(new RegExp('\n'), '<br>'); 251 result = result.replace(new RegExp('\n'), '<br>');
256 } 252 }
257//} catch (exception) {
258 //console.log("####", result, aKeyPath, someKeyValues, exception);
259//}
260 253
261 return result; 254 return result;
262} 255}
263 256
264Clipperz.PM.Strings.errorDescriptionForException = function (anException) { 257Clipperz.PM.Strings.errorDescriptionForException = function (anException) {
265 var result; 258 var result;
266 259
267 result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name); 260 result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name);
268 261
269 if (result == null) { 262 if (result == null) {
270 result = anException.message; 263 result = anException.message;
271 } 264 }
272 265
273 return result; 266 return result;
274}, 267},
275 268
276//----------------------------------------------------------------------------- 269//-----------------------------------------------------------------------------
277 270
278Clipperz.PM.Strings.Languages.initSetup = function() { 271Clipperz.PM.Strings.Languages.initSetup = function() {
279 varlanguage; 272 varlanguage;
280 varlanguageParser; 273 varlanguageParser;
281 274
282 language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no" 275 language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no"
283 languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i"); 276 languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i");