Bug 1696206 - Vendor fluent.migrate 0.11; r=flod

Differential Revision: https://phabricator.services.mozilla.com/D108761
This commit is contained in:
Dan Minor 2021-03-17 18:51:01 +00:00
parent 42c4a7e79e
commit 28d27c37f1
6 changed files with 16 additions and 97 deletions

View File

@ -1,56 +1,12 @@
Metadata-Version: 2.1
Name: fluent.migrate
Version: 0.10
Version: 0.11
Summary: Toolchain to migrate legacy translation to Fluent.
Home-page: https://hg.mozilla.org/l10n/fluent-migration/
Author: Mozilla
Author-email: l10n-drivers@mozilla.org
License: APL 2
Description: Fluent Migration Tools
======================
Programmatically create Fluent files from existing content in both legacy
and Fluent formats. Use recipes written in Python to migrate content for each
of your localizations.
`migrate-l10n` is a CLI script which uses the `fluent.migrate` module under
the hood to run migrations on existing translations.
`validate-l10n-recipe` is a CLI script to test a migration recipe for common
errors, without trying to apply it.
Installation
------------
Install from PyPI:
pip install fluent.migrate[hg]
If you only want to use the `MigrationContext` API, you can drop the
requirement on `python-hglib`:
pip install fluent.migrate
Usage
-----
Migrations consist of _recipes_, which are applied to a _localization repository_, based on _template files_.
You can find recipes for Firefox in `mozilla-central/python/l10n/fluent_migrations/`,
the reference repository is [gecko-strings](https://hg.mozilla.org/l10n/gecko-strings/) or _quarantine_.
You apply those migrations to l10n repositories in [l10n-central](https://hg.mozilla.org/l10n-central/), or to `gecko-strings` for testing.
The migrations are run as python modules, so you need to have their file location in `PYTHONPATH`.
An example would look like
$ migrate-l10n --lang it --reference-dir gecko-strings --localization-dir l10n-central/it bug_1451992_preferences_sitedata bug_1451992_preferences_translation
Contact
-------
- mailing list: https://lists.mozilla.org/listinfo/tools-l10n
- bugzilla: [Open Bugs](https://bugzilla.mozilla.org/buglist.cgi?component=Fluent%20Migration&product=Localization%20Infrastructure%20and%20Tools&bug_status=__open__) - [New Bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Localization%20Infrastructure%20and%20Tools&component=Fluent%20Migration)
Description: UNKNOWN
Keywords: fluent,localization,l10n
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha

View File

@ -1,44 +0,0 @@
Fluent Migration Tools
======================
Programmatically create Fluent files from existing content in both legacy
and Fluent formats. Use recipes written in Python to migrate content for each
of your localizations.
`migrate-l10n` is a CLI script which uses the `fluent.migrate` module under
the hood to run migrations on existing translations.
`validate-l10n-recipe` is a CLI script to test a migration recipe for common
errors, without trying to apply it.
Installation
------------
Install from PyPI:
pip install fluent.migrate[hg]
If you only want to use the `MigrationContext` API, you can drop the
requirement on `python-hglib`:
pip install fluent.migrate
Usage
-----
Migrations consist of _recipes_, which are applied to a _localization repository_, based on _template files_.
You can find recipes for Firefox in `mozilla-central/python/l10n/fluent_migrations/`,
the reference repository is [gecko-strings](https://hg.mozilla.org/l10n/gecko-strings/) or _quarantine_.
You apply those migrations to l10n repositories in [l10n-central](https://hg.mozilla.org/l10n-central/), or to `gecko-strings` for testing.
The migrations are run as python modules, so you need to have their file location in `PYTHONPATH`.
An example would look like
$ migrate-l10n --lang it --reference-dir gecko-strings --localization-dir l10n-central/it bug_1451992_preferences_sitedata bug_1451992_preferences_translation
Contact
-------
- mailing list: https://lists.mozilla.org/listinfo/tools-l10n
- bugzilla: [Open Bugs](https://bugzilla.mozilla.org/buglist.cgi?component=Fluent%20Migration&product=Localization%20Infrastructure%20and%20Tools&bug_status=__open__) - [New Bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Localization%20Infrastructure%20and%20Tools&component=Fluent%20Migration)

View File

@ -418,9 +418,17 @@ class REPLACE(LegacySource):
"""
def __init__(
self, path, key, replacements,
normalize_printf=False, **kwargs
self, path, key, replacements, **kwargs
):
# We default normalize_printf to False except for .properties files.
# We still allow the caller to override the default value.
normalize_printf = False
if 'normalize_printf' in kwargs:
normalize_printf = kwargs['normalize_printf']
del kwargs['normalize_printf']
elif path.endswith('.properties'):
normalize_printf = True
super(REPLACE, self).__init__(path, key, **kwargs)
self.replacements = replacements
self.normalize_printf = normalize_printf

View File

@ -4,7 +4,7 @@ from setuptools import setup
setup(
name='fluent.migrate',
version='0.10',
version='0.11',
description='Toolchain to migrate legacy translation to Fluent.',
author='Mozilla',
author_email='l10n-drivers@mozilla.org',

View File

@ -24,7 +24,7 @@ coverage==5.1
distro==1.4.0
ecdsa==0.15
esprima==4.0.1
fluent.migrate==0.10
fluent.migrate==0.11
fluent.syntax==0.18.1
glean_parser==1.29.0
jsmin==2.1.0

View File

@ -87,9 +87,8 @@ ecdsa==0.15 \
esprima==4.0.1 \
--hash=sha256:08db1a876d3c2910db9cfaeb83108193af5411fc3a3a66ebefacd390d21323ee
# via -r requirements-mach-vendor-python.in
fluent.migrate==0.10 \
--hash=sha256:532322b53c895142cf7c1702f95b54b9d3d128fb92eab38f6e8c8a80c447d8c2 \
--hash=sha256:ee1b4d827cff6d1df7f9b6a4b3eb78a75f1dd425e2e71b2013fd0dd411167b3e
fluent.migrate==0.11 \
--hash=sha256:3b93fdba9cbc8702d160367ba3a0d5c120707fdde752af35aecf516ce80ed252
# via -r requirements-mach-vendor-python.in
fluent.syntax==0.18.1 \
--hash=sha256:0e63679fa4f1b3042565220a5127b4bab842424f07d6a13c12299e3b3835486a \