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



3 years ago
3 years ago


(Reporter: flod, Unassigned)



Firefox Tracking Flags

(firefox48 affected)




3 years ago
Per discussion on IRC: this is the script used to update locales when new strings are added to en-US

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

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
Priority: -- → P2
AFAICT the script at 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)

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.


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