gecko-dev/browser/locales/moz.build
Nick Alexander 98a644b4c8 Bug 1749435 - Use Fluent to localize bookmarks.html at run-time rather than build-time. r=flod,mak,fluent-reviewers
This modernizes an old part of the build system to not require
build-time localization at all.  That's generally preferable.

The most significant changes to the in-product functionality is to
make import localize HTML so that we can use Fluent's `data-l10n-id`.

The locale used is the user's current locale.  This is different than
the existing approach, which always uses the build-time (repack)
locale.  I believe this is a strictly superior user experience and it
may lead to future improvements where-in the default bookmarks become
truly dynamic and vary with the user's chosen locale rather than being
point-in-time decisions.

I tried to restrict these changes to only applen when we import the
default bookmarks, but I think the various layers of flags no longer
achieve this restriction in practice and the formatting and
localization will apply to all imported `bookmarks.html` files.  Since
we don't anticipate (nor ourselves write) these new things in
(respectively, to) `bookmarks.html`, and the file is already
user-controlled, I don't think this exposes any meaningful change in
functionality (or in security surface).

Some notes:

1) There's no migration of `.inc` -> `.ftl` because this is the lone
   `.inc` file.

2) I elected to prefix all strings with `default-bookmarks-`, since
   the existing names were very short and likely to collide (now or in
   the future).

3) I elected to change the HTML file name for easier searching.

4) Since the `default-bookmarks.html` file is product-specific and the
   existing tests are in `toolkit/`, I elected to not test the file
   directly in automation.

5) We removed the explicit locale (or equivalent `%LOCALE%`) since
   Mozilla properties will redirect to the appropriate language
   automatically.

Differential Revision: https://phabricator.services.mozilla.com/D135816
2022-01-19 17:02:26 +00:00

39 lines
1.4 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
JAR_MANIFESTS += ["jar.mn"]
# If DIST_SUBDIR ever gets unset in browser this path might be wrong due to PREF_DIR changing.
LOCALIZED_PP_FILES.defaults.preferences += ["en-US/firefox-l10n.js"]
if CONFIG["MOZ_CRASHREPORTER"]:
LOCALIZED_FILES += ["en-US/crashreporter/crashreporter-override.ini"]
if CONFIG["MOZ_UPDATER"]:
LOCALIZED_GENERATED_FILES += ["updater.ini"]
updater = LOCALIZED_GENERATED_FILES["updater.ini"]
updater.script = "generate_ini.py"
updater.inputs = [
"en-US/updater/updater.ini",
"../installer/windows/nsis/updater_append.ini",
]
# Yes, this is weird, but what can you do? This file doesn't want to be in the DIST_SUBDIR,
# but we can't really move it to a different directory until we change how locale repacks
# work.
LOCALIZED_FILES[".."] += ["!updater.ini"]
with Files("**"):
BUG_COMPONENT = ("Firefox Build System", "General")
with Files("all-locales"):
BUG_COMPONENT = ("Core", "Localization")
with Files("en-US/**"):
BUG_COMPONENT = ("Core", "Localization")
with Files("shipped-locales"):
BUG_COMPONENT = ("Core", "Localization")