mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 943262 - Use CharsetMenu.jsm instead of charsetTitles.properties for Character Encoding menu items. r=bnicholson
This commit is contained in:
parent
bf48200eab
commit
90044610c2
@ -236,7 +236,6 @@ pref("accessibility.browsewithcaret_shortcut.enabled", false);
|
||||
// Whether the character encoding menu is under the main Firefox button. This
|
||||
// preference is a string so that localizers can alter it.
|
||||
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
|
||||
pref("intl.charsetmenu.browser.static", "chrome://browser/locale/browser.properties");
|
||||
|
||||
// pointer to the default engine name
|
||||
pref("browser.search.defaultenginename", "chrome://browser/locale/region.properties");
|
||||
|
@ -82,6 +82,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebappManager",
|
||||
"resource://gre/modules/WebappManager.jsm");
|
||||
#endif
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
|
||||
"resource://gre/modules/CharsetMenu.jsm");
|
||||
|
||||
// Lazily-loaded browser scripts:
|
||||
[
|
||||
["SelectHelper", "chrome://browser/content/SelectHelper.js"],
|
||||
@ -247,8 +250,7 @@ function resolveGeckoURI(aURI) {
|
||||
var Strings = {};
|
||||
[
|
||||
["brand", "chrome://branding/locale/brand.properties"],
|
||||
["browser", "chrome://browser/locale/browser.properties"],
|
||||
["charset", "chrome://global/locale/charsetTitles.properties"]
|
||||
["browser", "chrome://browser/locale/browser.properties"]
|
||||
].forEach(function (aStringBundle) {
|
||||
let [name, bundle] = aStringBundle;
|
||||
XPCOMUtils.defineLazyGetter(Strings, name, function() {
|
||||
@ -6421,40 +6423,31 @@ var CharacterEncoding = {
|
||||
},
|
||||
|
||||
getEncoding: function getEncoding() {
|
||||
function normalizeCharsetCode(charsetCode) {
|
||||
return charsetCode.trim().toLowerCase();
|
||||
}
|
||||
|
||||
function getTitle(charsetCode) {
|
||||
let charsetTitle = charsetCode;
|
||||
try {
|
||||
charsetTitle = Strings.charset.GetStringFromName(charsetCode + ".title");
|
||||
} catch (e) {
|
||||
dump("error: title not found for " + charsetCode);
|
||||
}
|
||||
return charsetTitle;
|
||||
function infoToCharset(info) {
|
||||
return { code: info.value, title: info.label };
|
||||
}
|
||||
|
||||
if (!this._charsets.length) {
|
||||
let charsets = Services.prefs.getComplexValue("intl.charsetmenu.browser.static", Ci.nsIPrefLocalizedString).data;
|
||||
this._charsets = charsets.split(",").map(function (charset) {
|
||||
return {
|
||||
code: normalizeCharsetCode(charset),
|
||||
title: getTitle(charset)
|
||||
};
|
||||
});
|
||||
let data = CharsetMenu.getData();
|
||||
|
||||
// In the desktop UI, the pinned charsets are shown above the rest.
|
||||
let pinnedCharsets = data.pinnedCharsets.map(infoToCharset);
|
||||
let otherCharsets = data.otherCharsets.map(infoToCharset)
|
||||
|
||||
this._charsets = pinnedCharsets.concat(otherCharsets);
|
||||
}
|
||||
|
||||
// if document charset is not in charset options, add it
|
||||
let docCharset = normalizeCharsetCode(BrowserApp.selectedBrowser.contentDocument.characterSet);
|
||||
let selected = 0;
|
||||
// Look for the index of the selected charset. Default to -1 if the
|
||||
// doc charset isn't found in the list of available charsets.
|
||||
let docCharset = BrowserApp.selectedBrowser.contentDocument.characterSet;
|
||||
let selected = -1;
|
||||
let charsetCount = this._charsets.length;
|
||||
for (; selected < charsetCount && this._charsets[selected].code != docCharset; selected++);
|
||||
if (selected == charsetCount) {
|
||||
this._charsets.push({
|
||||
code: docCharset,
|
||||
title: getTitle(docCharset)
|
||||
});
|
||||
|
||||
for (let i = 0; i < charsetCount; i++) {
|
||||
if (this._charsets[i].code === docCharset) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
|
@ -154,10 +154,6 @@ password.dontSave=Don't save
|
||||
# menu, set this to "true". Otherwise, you can leave it as "false".
|
||||
browser.menu.showCharacterEncoding=false
|
||||
|
||||
# LOCALIZATION NOTE (intl.charsetmenu.browser.static): Set to a series of comma separated
|
||||
# values for charsets that the user can select from in the Character Encoding menu.
|
||||
intl.charsetmenu.browser.static=iso-8859-1,utf-8,big5,iso-2022-jp,shift_jis,euc-jp
|
||||
|
||||
# Text Selection
|
||||
selectionHelper.textCopied=Text copied to clipboard
|
||||
|
||||
|
@ -86,14 +86,12 @@ relativesrcdir toolkit/locales:
|
||||
|
||||
# overrides for dom l10n, also for en-US
|
||||
relativesrcdir dom/locales:
|
||||
locale/@AB_CD@/browser/overrides/charsetTitles.properties (%chrome/charsetTitles.properties)
|
||||
locale/@AB_CD@/browser/overrides/global.dtd (%chrome/global.dtd)
|
||||
locale/@AB_CD@/browser/overrides/AccessFu.properties (%chrome/accessibility/AccessFu.properties)
|
||||
locale/@AB_CD@/browser/overrides/dom/dom.properties (%chrome/dom/dom.properties)
|
||||
#about:plugins
|
||||
locale/@AB_CD@/browser/overrides/plugins.properties (%chrome/plugins.properties)
|
||||
|
||||
% override chrome://global/locale/charsetTitles.properties chrome://browser/locale/overrides/charsetTitles.properties
|
||||
% override chrome://global/locale/global.dtd chrome://browser/locale/overrides/global.dtd
|
||||
% override chrome://global/locale/AccessFu.properties chrome://browser/locale/overrides/AccessFu.properties
|
||||
% override chrome://global/locale/dom/dom.properties chrome://browser/locale/overrides/dom/dom.properties
|
||||
|
Loading…
Reference in New Issue
Block a user