From fb8c7c8faa32e45accbb402c02a529978ed3d37e Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 17 Feb 2009 05:00:04 +0000 Subject: [PATCH] Backport r12197 from trunk: en-US is better than no MARC editor tooltips at all; but we really need to HEAD the requested locale git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@12198 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 293c971bfd..aee2bed3ae 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -124,18 +124,26 @@ function my_init() { // Try to get the locale from our preferences netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - try { - const Cc = Components.classes; - const Ci = Components.interfaces; - locale = Cc["@mozilla.org/preferences-service;1"]. + try { + const Cc = Components.classes; + const Ci = Components.interfaces; + locale = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch). getCharPref("general.useragent.locale"); - } + } catch (e) { } - // Get the locale-specific tooltips // TODO: We should send a HEAD request to check for the existence of the desired file - // then fall back to the default locale if preferred locale is not necessary + // then fall back to the default locale if preferred locale is not necessary; + // however, for now we have a simplistic check: + // + // we currently have translations for only two locales; in the absence of a + // valid locale, default to the almighty en-US + if (locale != 'en-US' && locale != 'fr-CA') { + locale = 'en-US'; + } + + // Get the locale-specific tooltips req.open('GET','/xul/server/locale/' + locale + '/marcedit-tooltips.xml',true); context_menus = createComplexXULElement('popupset'); -- 2.11.0