Skip to content

Commit

Permalink
Bug 1936528 - Rename generated update.locale as default.locale, alway…
Browse files Browse the repository at this point in the history
…s include it r=nalexander,geckoview-reviewers,browser-installer-reviewers,valentin,ohall

Differential Revision: https://phabricator.services.mozilla.com/D232605
  • Loading branch information
eemeli committed Feb 5, 2025
1 parent 942a126 commit ce4209d
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 40 deletions.
2 changes: 1 addition & 1 deletion browser/installer/allowed-dupes.mn
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ res/table-remove-column.gif
res/table-remove-row.gif

res/multilocale.txt
update.locale
default.locale

# Bug 1451016 - Nightly-only PaymentRequest & Form Autofill code sharing.
browser/features/[email protected]/chrome/content/editAddress.xhtml
Expand Down
2 changes: 1 addition & 1 deletion browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#ifdef HAVE_MAKENSISU
@BINPATH@/uninstall/helper.exe
#endif
@RESPATH@/default.locale
#ifdef MOZ_UPDATER
@RESPATH@/update.locale
@RESPATH@/updater.ini
#endif
#if defined(MOZ_UPDATE_AGENT)
Expand Down
4 changes: 2 additions & 2 deletions intl/docs/locale_startup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Data Sources

There are three primary sources that become available during the bootstrap.

1) Packaged locale lists stored in files :js:`update.locale` and :js:`multilocale.txt`.
1) Packaged locale lists stored in files :js:`default.locale` and :js:`multilocale.txt`.

2) User preferences read from the profile.

Expand Down Expand Up @@ -60,7 +60,7 @@ are being read, so the data is being fetched using packaged preferences.

In case of Desktop Firefox the :js:`intl.locale.requested` pref will be not set,
which means Gecko will use the default locale which is retrieved from
:js:`update.locale` file (also packaged).
:js:`default.locale` file (also packaged).

This means that the initial result of language negotiation is between packaged
locales as available and the default requested locale.
Expand Down
8 changes: 4 additions & 4 deletions intl/locale/LocaleService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ LocaleService::GetDefaultLocale(nsACString& aRetVal) {
// time), so we cache the result the first time we're called.
if (mDefaultLocale.IsEmpty()) {
nsAutoCString locale;
// Try to get the package locale from update.locale in omnijar. If the
// update.locale file is not found, item.len will remain 0 and we'll
// Try to get the package locale from default.locale in omnijar. If the
// default.locale file is not found, item.len will remain 0 and we'll
// just use our hard-coded default below.
GetGREFileContents("update.locale", &locale);
GetGREFileContents("default.locale", &locale);
locale.Trim(" \t\n\r");
#ifdef MOZ_UPDATER
// This should never be empty.
Expand All @@ -421,7 +421,7 @@ LocaleService::GetDefaultLocale(nsACString& aRetVal) {
mDefaultLocale.Assign(locale);
}

// Hard-coded fallback to allow us to survive even if update.locale was
// Hard-coded fallback to allow us to survive even if default.locale was
// missing/broken in some way.
if (mDefaultLocale.IsEmpty()) {
GetLastFallbackLocale(mDefaultLocale);
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/installer/allowed-dupes.mn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ res/table-remove-column.gif
res/table-remove-row.gif

res/multilocale.txt
update.locale
default.locale

#ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
defaults/pref/arm64-v8a/geckoview-prefs.js
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[@AB_CD@]
@BINPATH@/@PREF_DIR@/mobile-l10n.js
@BINPATH@/update.locale
@BINPATH@/default.locale
#ifdef MOZ_UPDATER
@BINPATH@/updater.ini
#endif
Expand Down
1 change: 0 additions & 1 deletion mobile/android/installer/removed-files.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
update.locale
README.txt
components/dom_webspeech.xpt
2 changes: 1 addition & 1 deletion mobile/ios/installer/allowed-dupes.mn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ res/table-remove-column.gif
res/table-remove-row.gif

res/multilocale.txt
update.locale
default.locale

components/httpd.sys.mjs
chrome/remote/content/server/httpd.sys.mjs
7 changes: 0 additions & 7 deletions modules/libjar/nsJARChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,6 @@ static void RecordZeroLengthEvent(bool aIsSync, const nsCString& aSpec,
return;
}

// See bug 1695560. "update.locale" with
// NS_ERROR_FILE_NOT_FOUND is filtered out.
if (fileName.EqualsLiteral("omni.ja!/update.locale") &&
aStatus == NS_ERROR_FILE_NOT_FOUND) {
return;
}

glean::zero_byte_load::LoadOthersExtra extra = {
.cancelReason = Some(aCanceledReason),
.cancelled = Some(aCanceled),
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ exclude = [
"toolkit/components/featuregates",
"toolkit/content/tests/chrome/file_about_networking_wsh.py",
"toolkit/library/build/dependentlibs.py",
"toolkit/locales/generate_update_locale.py",
"toolkit/mozapps",
"toolkit/moz.configure",
"toolkit/nss.configure",
Expand Down
2 changes: 1 addition & 1 deletion python/mozbuild/mozbuild/action/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
"*.toml",
"localization/**",
"modules/**",
"update.locale",
"default.locale",
"greprefs.js",
],
"dest": "bin",
Expand Down
2 changes: 1 addition & 1 deletion python/mozbuild/mozpack/packager/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,6 @@ def is_resource(self, path):
"dictionaries",
"hyphenation",
"localization",
"update.locale",
"default.locale",
"contentaccessible",
]
2 changes: 1 addition & 1 deletion python/mozbuild/mozpack/test/test_packager_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def is_resource(base, path):
self.assertTrue(is_resource(base, "modules/foo.jsm"))
self.assertTrue(is_resource(base, "greprefs.js"))
self.assertTrue(is_resource(base, "hyphenation/foo"))
self.assertTrue(is_resource(base, "update.locale"))
self.assertTrue(is_resource(base, "default.locale"))
self.assertFalse(is_resource(base, "foo"))
self.assertFalse(is_resource(base, "foo/bar/greprefs.js"))
self.assertTrue(is_resource(base, "defaults/messenger/foo.dat"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Generate update.locale, which simply contains the name of the current locale.
# Generate default.locale, which simply contains the name of the current locale.


def main(output, locale=None):
assert locale is not None
# update.locale is a trivial file but let's be unicode aware anyway.
# default.locale is a trivial file but let's be unicode aware anyway.
print(locale, file=output)
8 changes: 4 additions & 4 deletions toolkit/locales/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ FINAL_TARGET_FILES.res += [
"!multilocale.txt",
]

LOCALIZED_GENERATED_FILES += ["update.locale"]
update_locale = LOCALIZED_GENERATED_FILES["update.locale"]
update_locale.script = "generate_update_locale.py"
LOCALIZED_FILES += ["!update.locale"]
LOCALIZED_GENERATED_FILES += ["default.locale"]
default_locale = LOCALIZED_GENERATED_FILES["default.locale"]
default_locale.script = "generate_default_locale.py"
LOCALIZED_FILES += ["!default.locale"]

LOCALIZED_GENERATED_FILES += ["locale.ini"]
LOCALIZED_GENERATED_FILES["locale.ini"].script = "generate_locale_ini.py"
Expand Down
18 changes: 8 additions & 10 deletions toolkit/modules/UpdateUtils.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const PER_INSTALLATION_PREFS_PLATFORMS = ["win"];
// located in the update directory which makes it a common setting across all
// application profiles and allows the Background Update Agent to read it.
const FILE_UPDATE_CONFIG_JSON = "update-config.json";
const FILE_UPDATE_LOCALE = "update.locale";
const FILE_DEFAULT_LOCALE = "default.locale";
const PREF_APP_DISTRIBUTION = "distribution.id";
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";

Expand Down Expand Up @@ -116,8 +116,8 @@ export var UpdateUtils = {
},

/**
* Gets the locale from the update.locale file for replacing %LOCALE% in the
* update url. The update.locale file can be located in the application
* Gets the locale from the default.locale file for replacing %LOCALE% in the
* update url. The default.locale file can be located in the application
* directory or the GRE directory with preference given to it being located in
* the application directory.
*/
Expand All @@ -127,7 +127,7 @@ export var UpdateUtils = {
}

for (let res of ["app", "gre"]) {
const url = "resource://" + res + "/" + FILE_UPDATE_LOCALE;
const url = `resource://${res}/${FILE_DEFAULT_LOCALE}`;
let data;
try {
data = await fetch(url);
Expand All @@ -139,12 +139,10 @@ export var UpdateUtils = {
return (this._locale = locale.trim());
}
}
if (AppConstants.MOZ_UPDATER) {
console.error(
FILE_UPDATE_LOCALE,
" file doesn't exist in either the application or GRE directories"
);
}
console.error(
FILE_DEFAULT_LOCALE,
" file doesn't exist in either the application or GRE directories"
);

return (this._locale = null);
},
Expand Down
1 change: 1 addition & 0 deletions toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ add_task(async function test_build_target() {

// url constructed with %LOCALE%
// Bug 488936 added the update.locale file that stores the update locale
// Bug 1936528 renamed it as default.locale
add_task(async function test_locale() {
// The code that gets the locale accesses the profile which is only available
// after calling do_get_profile in xpcshell tests. This prevents an error from
Expand Down
2 changes: 1 addition & 1 deletion toolkit/mozapps/installer/l10n-repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"defaults/profile",
"defaults/pref*/*-l10n.js",
"locale.ini",
"update.locale",
"default.locale",
"updater.ini",
"extensions/langpack-*@*",
"distribution/extensions/langpack-*@*",
Expand Down

0 comments on commit ce4209d

Please sign in to comment.