From e960584a8dc509fe2e16704bca0546fffd2c21cf Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Tue, 20 Nov 2007 00:22:12 +0200 Subject: [PATCH] Localize the NEW button --- js/ajatus.core.js | 277 +++++++++++++++++++++++++------------------------- js/languages/en_GB.js | 6 +- js/languages/fi_FI.js | 1 + 3 files changed, 145 insertions(+), 139 deletions(-) diff --git a/js/ajatus.core.js b/js/ajatus.core.js index 787cdad..c9389b8 100644 --- a/js/ajatus.core.js +++ b/js/ajatus.core.js @@ -41,8 +41,8 @@ if (typeof console == 'undefined') { $.ajatus.converter = {}; $.ajatus.converter.parseJSON = function (json_str) { - try - { + try + { return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( json_str.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + json_str + ')'); @@ -53,7 +53,7 @@ if (typeof console == 'undefined') { } } $.ajatus.converter.toJSON = function (item,item_type) { - var m = { + var m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', @@ -128,51 +128,51 @@ if (typeof console == 'undefined') { }; conv = function (x) { var itemtype = typeof x; - switch(itemtype) { - case "array": - return s.arr(x); - break; - case "object": - return s.obj(x); - break; - case "string": - return s.str(x); - break; - case "number": - return s.num(x); - break; - case "null": - return s.nul(x); - break; - case "boolean": - return s.bool(x); - break; - } + switch(itemtype) { + case "array": + return s.arr(x); + break; + case "object": + return s.obj(x); + break; + case "string": + return s.str(x); + break; + case "number": + return s.num(x); + break; + case "null": + return s.nul(x); + break; + case "boolean": + return s.bool(x); + break; + } } - var itemtype = item_type || typeof item; - switch(itemtype) { - case "array": - return s.arr(item); - break; - case "object": - return s.obj(item); - break; - case "string": - return s.str(item); - break; - case "number": - return s.num(item); - break; - case "null": - return s.nul(item); - break; - case "boolean": - return s.bool(item); - break; - default: - throw("Unknown type for $.ajatus.converter.toJSON"); - } + var itemtype = item_type || typeof item; + switch(itemtype) { + case "array": + return s.arr(item); + break; + case "object": + return s.obj(item); + break; + case "string": + return s.str(item); + break; + case "number": + return s.num(item); + break; + case "null": + return s.nul(item); + break; + case "boolean": + return s.bool(item); + break; + default: + throw("Unknown type for $.ajatus.converter.toJSON"); + } } $.ajatus.formatter = {}; @@ -285,15 +285,15 @@ if (typeof console == 'undefined') { var year = date.getFullYear(); month++; - for (var i = 0; i < 3; i++) { - date_str += format.charAt(3) + - (format.charAt(i) == 'D' ? $.ajatus.formatter.date.fix_length(day) : - (format.charAt(i) == 'M' ? $.ajatus.formatter.date.fix_length(month) : - (format.charAt(i) == 'Y' ? year : '?'))); - } - date_str = date_str.substring(format.charAt(3) ? 1 : 0); - - return date_str; + for (var i = 0; i < 3; i++) { + date_str += format.charAt(3) + + (format.charAt(i) == 'D' ? $.ajatus.formatter.date.fix_length(day) : + (format.charAt(i) == 'M' ? $.ajatus.formatter.date.fix_length(month) : + (format.charAt(i) == 'Y' ? year : '?'))); + } + date_str = date_str.substring(format.charAt(3) ? 1 : 0); + + return date_str; }; $.ajatus.formatter.date.iso8601_to_caltime = function(iso_date, format) { var format = format || "HMS:"; @@ -306,7 +306,7 @@ if (typeof console == 'undefined') { M: $.ajatus.formatter.date.fix_length(date.getMinutes()), S: $.ajatus.formatter.date.fix_length(date.getSeconds()) }; - var separator = format.charAt(format.length - 1); + var separator = format.charAt(format.length - 1); var fparts = format.split(""); var utt1_parts = user_test_time1.split(utt1_seprt); @@ -317,8 +317,8 @@ if (typeof console == 'undefined') { time_str += fparts[k] + separator; }); time_str = time_str.substring(1); - - return time_str; + + return time_str; }; $.ajatus.tags = { @@ -491,14 +491,14 @@ if (typeof console == 'undefined') { }; tag = new $.ajatus.document(tag); - var now = $.ajatus.formatter.date.js_to_iso8601(new Date()); - var new_metadata = { - created: now, - creator: $.ajatus.preferences.local.user.name, - revised: now, - revisor: $.ajatus.preferences.local.user.name - }; - tag = $.ajatus.document.modify_metadata(tag, new_metadata); + var now = $.ajatus.formatter.date.js_to_iso8601(new Date()); + var new_metadata = { + created: now, + creator: $.ajatus.preferences.local.user.name, + revised: now, + revisor: $.ajatus.preferences.local.user.name + }; + tag = $.ajatus.document.modify_metadata(tag, new_metadata); jqc.save($.ajatus.preferences.client.tags_database, tag); return true; @@ -617,39 +617,39 @@ if (typeof console == 'undefined') { $.ajatus.views.on_change(new_hash); function parent(event) { - var element = event.target; - if (element) - { - if (element.tagName == "UL") - { - return element; - } + var element = event.target; + if (element) + { + if (element.tagName == "UL") + { + return element; + } - while(element.tagName != "UL") - { - element = element.parentNode; - } - } - return element; - }; + while(element.tagName != "UL") + { + element = element.parentNode; + } + } + return element; + }; - function target(event) { - var element = event.target; - if (element) - { - if (element.tagName == "UL") - { - element = jQuery(element).find('li').eq(0); - return element; - } + function target(event) { + var element = event.target; + if (element) + { + if (element.tagName == "UL") + { + element = jQuery(element).find('li').eq(0); + return element; + } - while(element.tagName != "LI") - { - element = element.parentNode; - } - } - return element; - }; + while(element.tagName != "LI") + { + element = element.parentNode; + } + } + return element; + }; }; $.jqcouch.on_error = function(request,caller) { @@ -658,33 +658,33 @@ if (typeof console == 'undefined') { $.jqcouch.on_success = function(data,caller) { $.ajatus.ajax_success(data, caller); }; - - $.ajatus.security_pass = function() { - try { + + $.ajatus.security_pass = function() { + try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite UniversalFileRead"); } catch (e) { alert("Permission UniversalBrowserRead denied. with error "+e); } - }; - - $.ajatus.init = function(element, options) { - //$.ajatus.security_pass(); - - var application_element = $(element); - $.ajatus.application_element = application_element; - $.ajatus.application_content_area = $('#middle #content', $.ajatus.application_element); - $.ajatus.application_dynamic_elements = $('#dynamic-elements', $.ajatus.application_element); + }; + + $.ajatus.init = function(element, options) { + //$.ajatus.security_pass(); + + var application_element = $(element); + $.ajatus.application_element = application_element; + $.ajatus.application_content_area = $('#middle #content', $.ajatus.application_element); + $.ajatus.application_dynamic_elements = $('#dynamic-elements', $.ajatus.application_element); $.ajatus.preferences.client.server_url = window.location.protocol + '//' + document.hostname + (window.location.port != '' ? ':'+window.location.port : '') + '/'; - $.ajatus.preferences.client = $.extend({}, $.ajatus.preferences.client_defaults, options); - $.jqcouch.server_url = $.ajatus.preferences.client.server_url; - - var a_db_suffix = $.ajatus.preferences.client.application_database_identifier != '' ? '_db' : 'db'; - $.ajatus.preferences.client.application_database = 'ajatus_' + $.ajatus.preferences.client.application_database_identifier + a_db_suffix; - $.ajatus.preferences.client.content_database = $.ajatus.preferences.client.application_database + '_content'; - $.ajatus.preferences.client.tags_database = $.ajatus.preferences.client.application_database + '_tags'; - + $.ajatus.preferences.client = $.extend({}, $.ajatus.preferences.client_defaults, options); + $.jqcouch.server_url = $.ajatus.preferences.client.server_url; + + var a_db_suffix = $.ajatus.preferences.client.application_database_identifier != '' ? '_db' : 'db'; + $.ajatus.preferences.client.application_database = 'ajatus_' + $.ajatus.preferences.client.application_database_identifier + a_db_suffix; + $.ajatus.preferences.client.content_database = $.ajatus.preferences.client.application_database + '_content'; + $.ajatus.preferences.client.tags_database = $.ajatus.preferences.client.application_database + '_tags'; + $.ajaxSetup({ type: "GET", url: $.ajatus.preferences.client.server_url, @@ -714,15 +714,15 @@ if (typeof console == 'undefined') { }; $.ajatus.start = function() { - $.ajatus.events.lock_pool.increase(); - $.ajatus.locker = new $.ajatus.events.lock({ - watch: { - validate: function(){return $.ajatus.events.lock_pool.count == 0;}, - interval: 200, + $.ajatus.events.lock_pool.increase(); + $.ajatus.locker = new $.ajatus.events.lock({ + watch: { + validate: function(){return $.ajatus.events.lock_pool.count == 0;}, + interval: 200, safety_runs: 0 - }, - on_release: function(){ - $.ajatus.application_element.addClass('ajatus_initialized'); + }, + on_release: function(){ + $.ajatus.application_element.addClass('ajatus_initialized'); // var trs = $.ajatus.i10n.get('Test %s', ['one']); // console.log("$.ajatus.i10n.get('Test %s', ['one']): "+trs); @@ -739,7 +739,7 @@ if (typeof console == 'undefined') { // $.ajatus.toolbar.add_item('Preferences', 'images/icons/preferences.png', function(){console.log('preferences item clicked');}); // $.ajatus.toolbar.show(); - var show_frontpage = true; + var show_frontpage = true; if ( $.ajatus.history && $.ajatus.history.enabled) { @@ -747,11 +747,11 @@ if (typeof console == 'undefined') { } if (show_frontpage) { - $.ajatus.views.system.frontpage.render(); + $.ajatus.views.system.frontpage.render(); } - } - }); - + } + }); + var preference_loader = new $.ajatus.preferences.loader; preference_loader.load(); @@ -763,9 +763,10 @@ if (typeof console == 'undefined') { $.ajatus.preferences.client.language = lang; } $.ajatus.i10n.init($.ajatus.preferences.client.language); - - $('#header .app_version', $.ajatus.application_element).html($.ajatus.version.join('.')); - $('#header .tagline', $.ajatus.application_element).html($.ajatus.i10n.get('Distributed CRM')); + + $('#header .app_version', $.ajatus.application_element).html($.ajatus.version.join('.')); + $('#header .tagline', $.ajatus.application_element).html($.ajatus.i10n.get('Distributed CRM')); + $('#new-item-button').text($.ajatus.i10n.get('new')); $.ajatus.extensions.init({ on_ready: function(){ @@ -828,13 +829,13 @@ if (typeof console == 'undefined') { } } }; - + $.fn.initialize_ajatus = function(options) { - if (!$(this).is('.ajatus_initialized')) { - return new $.ajatus.init(this, options); - } - }; - + if (!$(this).is('.ajatus_initialized')) { + return new $.ajatus.init(this, options); + } + }; + })(jQuery); function initialize_ajatus() { diff --git a/js/languages/en_GB.js b/js/languages/en_GB.js index 9b4fad0..8b489dd 100644 --- a/js/languages/en_GB.js +++ b/js/languages/en_GB.js @@ -43,6 +43,7 @@ "save": "Save", "create": "Create", "create %s": "Create %s", + "new": "New", "actions": "Actions", "title": "Title", @@ -53,7 +54,9 @@ "email": "Email", "phone": "Phone", "hours": "Hours", - + "amount": "Amount", + "vat": "VAT", + "global tag": "Global Tag", "related objects": "Related Objects", @@ -95,6 +98,7 @@ "event": "Event", "tag": "Tag", "contact": "Contact", + "expense": "Expense report", // Document actions "unknown document action": "Unknown document action", diff --git a/js/languages/fi_FI.js b/js/languages/fi_FI.js index 15e39b1..0a30382 100644 --- a/js/languages/fi_FI.js +++ b/js/languages/fi_FI.js @@ -44,6 +44,7 @@ "save": "Tallenna", "create": "Luo", "create %s": "Luo %s", + "new": "Uusi", "actions": "Toiminnot", "title": "Otsikko", -- 2.11.4.GIT