mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
72c78f28e5
have been there in the first place. r=tao, sr=alecf, a=asa
297 lines
11 KiB
XML
297 lines
11 KiB
XML
<?xml version="1.0"?>
|
|
<!--
|
|
The contents of this file are subject to the Netscape Public
|
|
License Version 1.1 (the "License"); you may not use this file
|
|
except in compliance with the License. You may obtain a copy of
|
|
the License at http://www.mozilla.org/NPL/
|
|
|
|
Software distributed under the License is distributed on an "AS
|
|
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
implied. See the License for the specific language governing
|
|
rights and limitations under the License.
|
|
|
|
Contributor(s): J. M. Betak <loadrunner@betak.net>
|
|
Josh Soref <timeless@mac.com>
|
|
-->
|
|
|
|
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
|
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
|
|
|
<!DOCTYPE window [
|
|
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
|
%brandDTD;
|
|
<!ENTITY % regionDTD SYSTEM "chrome://global-region/locale/region.dtd" >
|
|
%regionDTD;
|
|
<!ENTITY % prefContentDTD SYSTEM "chrome://content-packs/locale/pref-contentpacks.dtd" >
|
|
%prefContentDTD;
|
|
]>
|
|
|
|
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
onload="parent.initPanel('chrome://content-packs/content/pref-contentpacks.xul'); "
|
|
headertitle="&lHeader;">
|
|
|
|
<stringbundle id="bundle_contentPack"
|
|
src="chrome://content-packs/locale/contentpacks.properties"/>
|
|
|
|
<stringbundle id="bundle_brand"
|
|
src="chrome://global/locale/brand.properties"/>
|
|
|
|
<script type="application/x-javascript">
|
|
<![CDATA[
|
|
var _elementIDs = ["contentPackTree", "languagePackTree"];
|
|
|
|
|
|
function Startup()
|
|
{
|
|
var contentTree = document.getElementById( "contentPackTree" );
|
|
var regionName = contentTree.getAttribute("prefvalue");
|
|
var regionElements = contentTree.getElementsByAttribute("value", regionName);
|
|
|
|
if (regionElements.length) {
|
|
contentTree.selectItem(regionElements[0].parentNode.parentNode);
|
|
} else {
|
|
contentTree.selectedIndex = 0;
|
|
}
|
|
|
|
var languageTree = document.getElementById( "languagePackTree" );
|
|
var languageName = languageTree.getAttribute("prefvalue");
|
|
var languageElements =languageTree.getElementsByAttribute("value", languageName);
|
|
|
|
if (languageElements.length) {
|
|
languageTree.selectItem(languageElements[0].parentNode.parentNode);
|
|
} else {
|
|
languageTree.selectedIndex = 0;
|
|
}
|
|
parent.hPrefWindow.registerOKCallbackFunc( SwitchPacks );
|
|
}
|
|
|
|
function SwitchPacks()
|
|
{
|
|
SwitchContentPack();
|
|
SwitchLanguagePack();
|
|
}
|
|
|
|
function SwitchContentPack()
|
|
{
|
|
var oldContentPack = parent.hPrefWindow.getPref( "localizedstring", "general.useragent.contentlocale");
|
|
var newContentPack;
|
|
|
|
try {
|
|
var tree = document.getElementById("contentPackTree");
|
|
if (tree) {
|
|
var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null;
|
|
if (selectedItem) {
|
|
newContentPack = selectedItem.firstChild.firstChild.getAttribute("value");
|
|
}
|
|
} else {
|
|
newContentPack = parent.hPrefWindow.wsm.dataManager.getItemData( "chrome://communicator/content/pref/pref-content.xul", "contentPackTree" ).prefvalue;
|
|
}
|
|
}
|
|
catch (e) {}
|
|
|
|
if (newContentPack && (newContentPack != oldContentPack))
|
|
{
|
|
try {
|
|
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
|
|
chromeRegistry.selectLocale(newContentPack, true);
|
|
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
|
observerService.notifyObservers(null, "locale-selected", null);
|
|
var contentBundle = document.getElementById("bundle_contentPack");
|
|
var brandBundle = document.getElementById("bundle_brand");
|
|
var alertText = contentBundle.getString("contentAlert");
|
|
alertText = alertText.replace(/%brand%/g, brandBundle.getString("brandShortName"));
|
|
var titleText = contentBundle.GetStringFromName("languageTitle");
|
|
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
|
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService)
|
|
promptService.alert(window, titleText, alertText);
|
|
}
|
|
catch(e) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function SwitchLanguagePack()
|
|
{
|
|
var oldLanguagePack = parent.hPrefWindow.getPref( "localizedstring", "general.useragent.locale");
|
|
var newLanguagePack;
|
|
|
|
try {
|
|
var languageTree = document.getElementById("languagePackTree");
|
|
if (languageTree) {
|
|
var selectedItem = languageTree.selectedItems.length ? languageTree.selectedItems[0] : null;
|
|
if (selectedItem) {
|
|
newLanguagePack = selectedItem.firstChild.firstChild.getAttribute("value");
|
|
}
|
|
} else {
|
|
newLanguagePack = parent.hPrefWindow.wsm.dataManager.getItemData( "chrome://communicator/content/pref/pref-content.xul", "languagePackTree" ).prefvalue;
|
|
}
|
|
}
|
|
catch (e) {}
|
|
if (newLanguagePack && (newLanguagePack != oldLanguagePack))
|
|
{
|
|
try {
|
|
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
|
|
chromeRegistry.selectLocale(newLanguagePack, true);
|
|
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
|
observerService.notifyObservers(null, "locale-selected", null);
|
|
}
|
|
catch(e) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function SelectContentPack()
|
|
{
|
|
var tree = document.getElementById("contentPackTree");
|
|
var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null;
|
|
|
|
if (selectedItem) {
|
|
var classType = selectedItem.firstChild.firstChild.getAttribute("class");
|
|
if (classType == "outofdate") {
|
|
//Make it so that out of date content packs cannot be selected by the user
|
|
tree.removeItemFromSelection(selectedItem);
|
|
}
|
|
else {
|
|
var regionName = selectedItem.firstChild.firstChild.getAttribute("value");
|
|
tree.setAttribute("prefvalue", regionName);
|
|
}
|
|
}
|
|
}
|
|
|
|
function SelectLanguagePack()
|
|
{
|
|
var tree = document.getElementById("languagePackTree");
|
|
var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null;
|
|
|
|
if (selectedItem) {
|
|
var classType = selectedItem.firstChild.firstChild.getAttribute("class");
|
|
if (classType == "outofdate") {
|
|
//Make it so that out of date language packs cannot be selected by the user
|
|
tree.removeItemFromSelection(selectedItem);
|
|
}
|
|
else {
|
|
var languageName = selectedItem.firstChild.firstChild.getAttribute("value");
|
|
tree.setAttribute("prefvalue", languageName);
|
|
}
|
|
}
|
|
}
|
|
|
|
function DownloadRegionPacks()
|
|
{
|
|
openTopWin(xlateURL("urn:clienturl:viewmenu:intlwebcontent"));
|
|
}
|
|
]]>
|
|
</script>
|
|
|
|
<hbox class="box-smallheader" title="&lHeader;"/>
|
|
|
|
<!-- Content (aka region) pack tree -->
|
|
<description>&contentIntro.label;</description>
|
|
<separator class="thin"/>
|
|
<description>&installedContentPacks.label;</description>
|
|
<tree id="contentPackTree" flex="1" rows="2"
|
|
ref="urn:mozilla:locale:root" datasources="rdf:chrome"
|
|
sortResource="http://www.mozilla.org/rdf/chrome#name"
|
|
preftype="localizedstring" prefstring="general.useragent.contentlocale"
|
|
prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue"
|
|
seltype="false" onselect="SelectContentPack();"
|
|
sortDirection="ascending">
|
|
<treecolgroup>
|
|
<treecol flex="1"/>
|
|
</treecolgroup>
|
|
<template xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
|
|
|
<!-- This rule displays only up to date content packs based on the localeVersion -->
|
|
<rule chrome:localeType="region" chrome:localeVersion="&content.version;">
|
|
<treechildren flex="1">
|
|
<treeitem id="treechildren" uri="..." translation="true" nselected="false" >
|
|
<treerow>
|
|
<treecell label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
|
|
value="rdf:http://www.mozilla.org/rdf/chrome#name"/>
|
|
</treerow>
|
|
</treeitem>
|
|
</treechildren>
|
|
</rule>
|
|
|
|
<!-- This rule "falls through" to match obsolete content packs -->
|
|
<rule chrome:localeType="region">
|
|
<treechildren flex="1">
|
|
<treeitem id="treechildren" uri="..." translation="true" nselected="false" >
|
|
<treerow>
|
|
<treecell class="outofdate"
|
|
label="rdf:http://www.mozilla.org/rdf/chrome#displayName &update.label;"
|
|
value="rdf:http://www.mozilla.org/rdf/chrome#name"/>
|
|
</treerow>
|
|
</treeitem>
|
|
</treechildren>
|
|
</rule>
|
|
|
|
</template>
|
|
</tree>
|
|
|
|
<!-- Language pack tree -->
|
|
<description>&languageIntro.label;</description>
|
|
<separator class="thin"/>
|
|
<description>&installedLanguagePacks.label;</description>
|
|
<tree id="languagePackTree" flex="1" rows="3"
|
|
ref="urn:mozilla:locale:root"
|
|
datasources="rdf:chrome"
|
|
sortResource="http://www.mozilla.org/rdf/chrome#name"
|
|
preftype="localizedstring"
|
|
prefstring="general.useragent.locale"
|
|
prefattribute="prefvalue"
|
|
wsm_attributes="value"
|
|
seltype="false"
|
|
onselect="SelectLanguagePack();"
|
|
sortDirection="ascending">
|
|
<treecolgroup>
|
|
<treecol flex="1"/>
|
|
</treecolgroup>
|
|
<template xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
|
|
|
<!-- This rule eliminates region packs from the language pack list -->
|
|
<rule chrome:localeType="region"/>
|
|
|
|
<!-- This rule displays only up to date language packs based on the localeVersion -->
|
|
<rule chrome:localeVersion="&lang.version;">
|
|
<treechildren flex="1">
|
|
<treeitem id="treechildren" uri="..." translation="true" nselected="false" >
|
|
<treerow>
|
|
<treecell label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
|
|
value="rdf:http://www.mozilla.org/rdf/chrome#name"/>
|
|
</treerow>
|
|
</treeitem>
|
|
</treechildren>
|
|
</rule>
|
|
|
|
<!-- This rule "falls through" to match obsolete language packs -->
|
|
<rule>
|
|
<treechildren flex="1">
|
|
<treeitem id="treechildren" uri="..." translation="true" nselected="false" >
|
|
<treerow>
|
|
<treecell class="outofdate"
|
|
label="rdf:http://www.mozilla.org/rdf/chrome#displayName &update.label;"
|
|
value="rdf:http://www.mozilla.org/rdf/chrome#name"/>
|
|
</treerow>
|
|
</treeitem>
|
|
</treechildren>
|
|
</rule>
|
|
</template>
|
|
</tree>
|
|
|
|
<separator class="thin"/>
|
|
|
|
<hbox>
|
|
<spacer flex="1"/>
|
|
<button id="downloadContentPacks"
|
|
label="&downloadContentPacks.label;"
|
|
accesskey="&downloadContentPacks.accesskey;"
|
|
oncommand="DownloadRegionPacks()"/>
|
|
</hbox>
|
|
</page>
|
|
|