Fix Fluent localization for non-English locales

All declared Fluent files need to exist for a locale to be used (in a
window?). Since Mozilla code tries to load Fluent files, we need to copy
non-English Mozilla .ftl files to their default effective path (just in
the app omni.ja instead of the toolkit omni.ja).

Fixes #3094
This commit is contained in:
Dan Stillman 2023-04-23 02:55:36 -04:00 committed by Dan Stillman
parent c55ef8714b
commit 3693674fc9
8 changed files with 20 additions and 21 deletions

View file

@ -282,14 +282,20 @@ echo "Version: $VERSION"
rm -rf META-INF
# Copy branding
#cp -R "$CALLDIR/assets/branding/content" chrome/branding/content
cp -R "$CALLDIR"/assets/branding/locale/brand.{dtd,properties} chrome/en-US/locale/branding/
cp "$CALLDIR/assets/branding/locale/brand.ftl" localization/en-US/branding/brand.ftl
# Copy localization .ftl files
# Copy browser localization .ftl files
for locale in `ls chrome/locale/`; do
mkdir -p localization/$locale/mozilla
cp chrome/locale/$locale/zotero/mozilla/*.ftl localization/$locale/mozilla/
mkdir -p localization/$locale/branding
cp "$CALLDIR/assets/branding/locale/brand.ftl" localization/$locale/branding/brand.ftl
mkdir -p localization/$locale/toolkit/global
cp chrome/locale/$locale/zotero/mozilla/textActions.ftl localization/$locale/toolkit/global
cp chrome/locale/$locale/zotero/mozilla/wizard.ftl localization/$locale/toolkit/global
mkdir -p localization/$locale/browser
cp chrome/locale/$locale/zotero/mozilla/menubar.ftl localization/$locale/browser
# TEMP: Until we've created zotero.ftl in all locales
touch chrome/locale/$locale/zotero/zotero.ftl
cp chrome/locale/$locale/zotero/*.ftl localization/$locale/

View file

@ -45,8 +45,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
style="display: flex;">
<html:link rel="localization" href="mozilla/menubar.ftl"/>
<html:link rel="localization" href="mozilla/textActions.ftl"/>
<html:link rel="localization" href="browser/menubar.ftl"/>
<script>
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

View file

@ -109,7 +109,7 @@ window.addEventListener("contextmenu", e => {
let popup = document.getElementById("textbox-contextmenu");
if (!popup) {
MozXULElement.insertFTLIfNeeded("mozilla/textActions.ftl");
MozXULElement.insertFTLIfNeeded("toolkit/global/textActions.ftl");
document.documentElement.appendChild(
MozXULElement.parseXULToFragment(`
<popupset>

View file

@ -59,7 +59,7 @@
this._destroyed = false;
window.addEventListener("unload", this.destroy);
MozXULElement.insertFTLIfNeeded('mozilla/textActions.ftl');
MozXULElement.insertFTLIfNeeded('toolkit/global/textActions.ftl');
document.l10n.connectRoot(this);
// var s1 = document.createElement("link");

View file

@ -21,8 +21,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<html:link rel="localization" href="mozilla/menubar.ftl"/>
<html:link rel="localization" href="mozilla/textActions.ftl"/>
<html:link rel="localization" href="browser/menubar.ftl"/>
<script type="application/javascript">
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

View file

@ -48,8 +48,7 @@
width="1000" height="700"
persist="screenX screenY width height sizemode">
<html:link rel="localization" href="mozilla/menubar.ftl"/>
<html:link rel="localization" href="mozilla/textActions.ftl"/>
<html:link rel="localization" href="browser/menubar.ftl"/>
<script>
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

View file

@ -57,8 +57,7 @@
<html:link rel="localization" href="branding/brand.ftl"/>
<html:link rel="localization" href="mozilla/menubar.ftl"/>
<html:link rel="localization" href="mozilla/textActions.ftl"/>
<html:link rel="localization" href="browser/menubar.ftl"/>
<script>
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

View file

@ -83,12 +83,9 @@ def main():
"^intl.accept_languages"
]
},
{
"file": "browser/chrome/{0}/locale/browser/browser.dtd",
"grep_patterns": [
"preferencesCmd"
]
}
"browser/localization/{0}/browser/menubar.ftl",
"localization/{0}/toolkit/global/textActions.ftl",
"localization/{0}/toolkit/global/wizard.ftl"
]
extracted_files = {}