From d9290abddd6c89c5c2cd34f4543ffe7f30d6c0cb Mon Sep 17 00:00:00 2001 From: Anton Khodakivskiy Date: Sat, 20 Jul 2013 14:14:58 +0300 Subject: [PATCH] Closes #120. Cleaned up locales folder. Fixed logic of locale discovery. Now we rely on general.useragent.locale Firefox preference --- extension/chrome.manifest | 2 +- extension/install.rdf | 2 +- extension/locale/hu-HU/options.dtd | 21 -------- extension/locale/hu-HU/vimfx.properties | 65 ------------------------- extension/packages/l10n.coffee | 12 +++-- 5 files changed, 9 insertions(+), 93 deletions(-) delete mode 100644 extension/locale/hu-HU/options.dtd delete mode 100644 extension/locale/hu-HU/vimfx.properties diff --git a/extension/chrome.manifest b/extension/chrome.manifest index 54d3af7..50daaab 100644 --- a/extension/chrome.manifest +++ b/extension/chrome.manifest @@ -4,5 +4,5 @@ locale vimfx ru locale/ru/ locale vimfx zh-CN locale/zh-CN/ locale vimfx hu locale/hu/ locale vimfx de locale/de/ -locale vimfx el locale/el-GR/ +locale vimfx el-GR locale/el-GR/ locale vimfx nl locale/nl/ diff --git a/extension/install.rdf b/extension/install.rdf index ce479a4..8af42e9 100644 --- a/extension/install.rdf +++ b/extension/install.rdf @@ -54,7 +54,7 @@ - hu-HU + hu Vim billenytűparancsok Firefoxhoz diff --git a/extension/locale/hu-HU/options.dtd b/extension/locale/hu-HU/options.dtd deleted file mode 100644 index 64b784d..0000000 --- a/extension/locale/hu-HU/options.dtd +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/extension/locale/hu-HU/vimfx.properties b/extension/locale/hu-HU/vimfx.properties deleted file mode 100644 index 41a451a..0000000 --- a/extension/locale/hu-HU/vimfx.properties +++ /dev/null @@ -1,65 +0,0 @@ -button_tooltip_enabled=VimFx aktív. Kattints az inaktiváláshoz (Shift+Alt+V) -button_tooltip_disabled=VimFx inaktív. Kattints az aktiváláshoz (Shift+Alt+V) -button_tooltip_blacklisted=Az oldal feketelistázva a VimFX-ben. -item_preferences=Beállítások -item_help=Súgó -item_blacklist_button_tooltip=Feketelista - -help_section_urls =URL műveletek -help_command_o =Fókusz a címsorra -help_command_p =A vágólapon található link megnyitása -help_command_P =A vágólapon található link megnyitása új tabban -help_command_yf =Copy link url or text input value to the clipboard (needs translation) -help_command_vf =Focus element (needs translation) -help_command_yy =Aktuális oldal címének másolása vágólapra -help_command_r =Oldal újratöltése -help_command_R =Oldal újratöltése minden elemmel együtt (js, css, img) -help_command_ar =Összes oldal újratöltése -help_command_aR =Összes oldal újratöltése minden elemmel együtt (js, css, img) - -help_section_nav =Navigálás az oldalon -help_command_gg =Ugrás az oldal tetejére -help_command_G =Ugrás az oldal aljára -help_command_j_ce =Görgetés le -help_command_k_cy =Görgetés fel -help_command_h =Görgetés balra -help_command_l =Görgetés jobbra -help_command_d =Fél oldalnyi görgetés lefelé -help_command_u =Fél oldalnyi görgetés felfelé -help_command_cf =Oldalnyi görgetés lefelé -help_command_cb =Oldalnyi görgetés felfelé - -help_section_tabs =Tab műveletek -help_command_t =Új tab nyitása -help_command_J_gT =Ugrás az előző tabra -help_command_K_gt =Ugrás a következő tabra -help_command_cJ =Aktuális tab mozgatása balra -help_command_cK =Aktuális tab mozgatása jobbra -help_command_gh =Kezdőlap megnyitása -help_command_gH_g0 =Ugrás az első tabra -help_command_gL_g$ =Ugrás az utolsó tabra -help_command_x =Aktuális tab bezárása -help_command_X =Utoljára bezárt tab visszatöltése - -help_section_browse =Böngészés -help_command_f =Link követése -help_command_F =Link követése új tabban -help_command_H =Vissza az előzményekben -help_command_L =Előre az előzményekben - -help_section_misc =Általános -help_command_help =Súgó megjelenítése -help_command_Esc =Ennek az ablaknak bezárása és segédletek elrejtése -help_command_find =Keresési módba lépés -help_command_find_hl=Enter Find mode highlighting all matches(needs translation) -help_command_n =Következő találatra ugrás -help_command_N =Előző találatra ugrás -help_command_dev =Open Developer Toolbar(needs translation) - -help=Segítség -help_version=Verzió - -help_feedback=Hagyj visszajelzést! -help_enjoying=Kedveled a VimFX-et? -help_found_bug=Találtál egy bugot? -help_report_bug=Jelentsd itt! diff --git a/extension/packages/l10n.coffee b/extension/packages/l10n.coffee index 5e30c0c..bca76f3 100644 --- a/extension/packages/l10n.coffee +++ b/extension/packages/l10n.coffee @@ -1,12 +1,13 @@ { classes: Cc, interfaces: Ci } = Components +{ getFirefoxPref } = require 'prefs' + # Generates the underscore function l10n = do -> splitter = /(\w+)-\w+/ # Current locale - locale = Cc['@mozilla.org/chrome/chrome-registry;1'] - .getService(Ci.nsIXULChromeRegistry).getSelectedLocale('global') + locale = getFirefoxPref('general.useragent.locale') getStr = (aStrBundle, aKey) -> try return aStrBundle.GetStringFromName(aKey) @@ -16,11 +17,11 @@ l10n = do -> filePath = (locale) -> getResourceURI("locale/#{ locale }/#{ filename }").spec - # Folder in the format `en-US` + # Folder in the format `en-US`, e.g. locale/en-US/vimfx.properties defaultBundle = Services.strings.createBundle(filePath(locale)) if locale_base = locale.match(splitter) - # Folder in the basic format: `en` + # Folder in the basic format: `en`, e.g. locale/en/vimfx.properties defaultBasicBundle = Services.strings.createBundle(filePath(locale_base[1])) # Folder named after `defaultLocale` @@ -31,10 +32,11 @@ l10n = do -> localeBundle = null localeBasicBundle = null - # Yet another way to specify a folder + # Yet another way to specify a folder: both `en` or `en-US` are possible here if aLocale localeBundle = Services.strings.createBundle(filePath(aLocale)) + # And locale version without the region, e.g. `en` if locale_base = aLocale.match(splitter) localeBasicBundle = Services.strings.createBundle(filePath(locale_base[1])) -- 2.39.3