iOS XLIFF: Clean up output files before committing them to repository

RESOLVED FIXED

Status

P2
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: flod, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox48 affected)

Details

(Reporter)

Description

3 years ago
Per discussion on IRC: this is the script used to update locales when new strings are added to en-US
https://github.com/mozilla/firefox-ios-build-tools/blob/master/scripts/update-xliff.py

Right now when Pontoon commits files it creates a huge diff which is not usable on GitHub. It would be great to have this script run on files before committing them.

We fixed Pootle in https://github.com/translate/mozilla/issues/1

And there's also a pending PR to upstream an update to the script to pass a list of locales as parameters, and this might turn out to be useful for Pontoon too
https://github.com/mozilla/firefox-ios-build-tools/pull/22
Priority: -- → P2
AFAICT the script at https://github.com/mozilla/firefox-ios-build-tools/blob/master/scripts/update-xliff.py does 3 things for each localized XLIFF file:

1. Takes en-US file and updates/removes/adds targets.

2. Updates target-language (with locale mapping).

3. Fixes indent.

Running the script every time after our XLIFF serializer finishes its job would be a hack in our sync system and also suboptimal (e.g. in terms of I/O operations).

Instead, we should modify our existing serializer to match the functionality of the script. With the exception of locale maping (which would still need to be a bit hacky), other projects using XLIFF file format would also benefit from that approach.
Flags: needinfo?(francesco.lodolo)
(Reporter)

Comment 2

3 years ago
Uhm, what's the question? ;-)

I can confirm that the script does exactly what you're saying. Running the script on the output before commit would definitely be an hack (but also fast to implement), improving the serializer output would be a better/cleaner solution. The only limit is that we don't know how other systems using XLIFF (besides iOS) would create their files in the future.

I don't know how Pontoon stores the data internally before creating the XLIFF file, but it would be interesting to see if the diff is usable just applying the indent function.
Flags: needinfo?(francesco.lodolo)
(In reply to Francesco Lodolo [:flod] from comment #2)
> Uhm, what's the question? ;-)

Even if you don't know it, you answered it. ;) Sorry for not being more specific, I wanted to make sure I understand what the script does and hear your opinion on the proposed solution.

I'll add locale mapping to Pontoon and propose indent fix improvement to translate-toolkit. Before it's released, we'll use our custom fork.

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.