switchLocale.js File Reference

Locales switching function implementations. More...

Go to the source code of this file.

Functions

Components utils import ("resource://app/jsmodules/StringUtils.jsm")
 
window addEventListener ("unload", menubar_locales_bundle_module.onUnload, false)
 
function initLocalesBundle ()
 Initialize the Locales Bundle. More...
 
function resetLocalesBundle ()
 Reset the Locales Bundle to an uninitialized state. More...
 
function fillLocaleList (menu)
 Fill the Locales menu with all available Locales. More...
 
function getFlagFromBundle (locale)
 Get the flag icon URL for a Locales from the Locales bundle. More...
 
function sortLanguages (a, b)
 Sort Locale language names. More...
 
function installLocaleFromBundle (locale, bundleindex)
 Install a Locale from the Locales Bundle. More...
 
 catch (err)
 

Variables

const MENUBAR_LOCALESBUNDLE_TIMEOUT = 15000
 
 try
 
var menubar_locales_bundle = null
 
menubar_locales_bundle_module init_once = 0
 
menubar_locales_bundle_module deinit_once = 0
 
menubar_locales_bundle_module onLoad
 
var menubar_locales_installed = null
 
var menubarLocalesBundleCB
 Locales Bundle listener. Handles download completion and errors. More...
 

Detailed Description

Locales switching function implementations.

Note
Based on Firefox Locale Switcher, by Benjamin Smedberg (http://benjamin.smedbergs.us/blog/2005-11-29/locale-switcher-15/)

Definition in file switchLocale.js.

Function Documentation

window addEventListener ( "unload"  ,
menubar_locales_bundle_module.  onUnload,
false   
)
catch (   err)

Definition at line 371 of file switchLocale.js.

function fillLocaleList (   menu)

Fill the Locales menu with all available Locales.

Definition at line 230 of file switchLocale.js.

Here is the call graph for this function:

function getFlagFromBundle (   locale)

Get the flag icon URL for a Locales from the Locales bundle.

Parameters
localeThe locale.
Returns
The flag icon URL or null on error.

Definition at line 321 of file switchLocale.js.

Here is the caller graph for this function:

Components utils import ( "resource://app/jsmodules/StringUtils.jsm"  )
function initLocalesBundle ( )

Initialize the Locales Bundle.

Definition at line 69 of file switchLocale.js.

Here is the call graph for this function:

function installLocaleFromBundle (   locale,
  bundleindex 
)

Install a Locale from the Locales Bundle.

Parameters
localeThe locale to install (ie. "en-US").
bundleindexThe index of the locale within the bundle. Index starts at 0.

Definition at line 349 of file switchLocale.js.

Here is the call graph for this function:

function resetLocalesBundle ( )

Reset the Locales Bundle to an uninitialized state.

Definition at line 86 of file switchLocale.js.

function sortLanguages (   a,
  b 
)

Sort Locale language names.

Definition at line 334 of file switchLocale.js.

Here is the caller graph for this function:

Variable Documentation

menubar_locales_bundle_module deinit_once = 0

Definition at line 44 of file switchLocale.js.

menubar_locales_bundle_module init_once = 0

Definition at line 43 of file switchLocale.js.

var menubar_locales_bundle = null

Definition at line 41 of file switchLocale.js.

var menubar_locales_installed = null

Definition at line 63 of file switchLocale.js.

const MENUBAR_LOCALESBUNDLE_TIMEOUT = 15000

Definition at line 36 of file switchLocale.js.

var menubarLocalesBundleCB

Locales Bundle listener. Handles download completion and errors.

Definition at line 96 of file switchLocale.js.

menubar_locales_bundle_module onLoad
Initial value:
= function()
{
if (menubar_locales_bundle_module.init_once++) { dump("WARNING: menubar_locales_bundle double init!!\n"); return; }
}
menubar_locales_bundle_module.onUnload = function()
{
if (menubar_locales_bundle_module.deinit_once++) { dump("WARNING: menubar_locales_bundle double deinit!!\n"); return; }
window.removeEventListener("load", menubar_locales_bundle_module.onLoad, false);
window.removeEventListener("unload", menubar_locales_bundle_module.onUnload, false);
}
window.addEventListener("load", menubar_locales_bundle_module.onLoad, false)
let window
function initLocalesBundle()
Initialize the Locales Bundle.
Definition: switchLocale.js:69
function resetLocalesBundle()
Reset the Locales Bundle to an uninitialized state.
Definition: switchLocale.js:86

Definition at line 45 of file switchLocale.js.

try
Initial value:
{
var menubar_locales_bundle_module = {}

Definition at line 38 of file switchLocale.js.