mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
[FEATURE] Ability to switch content packs so that vendors can offer regional content.
Original patch from jbetak@netscape.com, r=ben@netscape.com, sr=hyatt@netscape.com, a=blizzard@mozilla.org pref-appearance.xul - add application language switching UI
This commit is contained in:
parent
9ba257fbe7
commit
84a4dee5d5
@ -40,9 +40,42 @@
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var panel = "chrome://communicator/content/pref/pref-appearance.xul";
|
||||
// the first elements in this array will be poked from chromeregistry loaded
|
||||
// overlays once overlays.rdf works properly
|
||||
var _elementIDs = ["generalStartupBrowser", "showHideTooltips"];
|
||||
// the first elements in this array will be poked from chromeregistry loaded
|
||||
// overlays once overlays.rdf works properly
|
||||
var _elementIDs = ["generalStartupBrowser", "showHideTooltips", "languageList"];
|
||||
|
||||
function Startup()
|
||||
{
|
||||
parent.hPrefWindow.registerOKCallbackFunc( switchUILanguage );
|
||||
}
|
||||
|
||||
function switchUILanguage()
|
||||
{
|
||||
|
||||
var oldLangCode = parent.hPrefWindow.getPref( "string", "general.useragent.locale");
|
||||
var newLangCode;
|
||||
|
||||
try {
|
||||
var languageList = document.getElementById('languageList');
|
||||
var newLangCode = languageList ?
|
||||
languageList.selectedItem.value :
|
||||
parent.hPrefWindow.wsm.dataManager.getItemData( "chrome://communicator/content/pref/pref-appearance.xul", "languageList" ).value;
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
if (newLangCode != oldLangCode) {
|
||||
try {
|
||||
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
|
||||
if ( chromeRegistry )
|
||||
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
|
||||
chromeRegistry.selectLocale(newLangCode, true);
|
||||
}
|
||||
catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
@ -71,11 +104,46 @@
|
||||
<radio group="toolbarStyle" value="1" label="&textonlyRadio.label;" accesskey="&textonlyRadio.accesskey;"/>
|
||||
</radiogroup>
|
||||
</titledbox>
|
||||
<box autostretch="never">
|
||||
|
||||
<vbox class="box-padded" autostretch="never">
|
||||
<separator class="thin" />
|
||||
|
||||
<checkbox id="showHideTooltips" label="&showHideTooltips.label;"
|
||||
accesskey="&showHideTooltips.accesskey;" pref="true"
|
||||
preftype="bool" prefstring="browser.chrome.toolbar_tips"
|
||||
prefattribute="checked"/>
|
||||
</box>
|
||||
|
||||
<separator/>
|
||||
|
||||
<html>&languageList.txt.label;</html>
|
||||
|
||||
<separator class="thin" />
|
||||
|
||||
<text class="label" value="&languageList.label;" for="languageList"/>
|
||||
|
||||
<separator class="thin" />
|
||||
|
||||
<menulist id="languageList" class="small-margin"
|
||||
pref="true" preftype="localizedstring"
|
||||
prefstring="general.useragent.locale" prefattribute="value"
|
||||
wsm_attributes="value"
|
||||
datasources="rdf:chrome" ref="urn:mozilla:locale:root"
|
||||
sortResource="http://www.mozilla.org/rdf/chrome#name"
|
||||
sortDirection="ascending">
|
||||
<template xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
<rule chrome:localeType="region"/>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem
|
||||
uri="..."
|
||||
label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
|
||||
value="rdf:http://www.mozilla.org/rdf/chrome#name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
</menulist>
|
||||
</vbox>
|
||||
|
||||
</window>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user