Use moz.l10n for serialization #3587
Draft
+598
−3,183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For context see #3538
Filing initially as a draft; will update once mozilla/moz-l10n#58 is merged and a new moz.l10n release is available.
This PR replaces the file serialisers with their moz.l10n equivalents. Serialization is now done by first parsing the corresponding source file, and then modifying it according to the state of the database. This means that any comments in target files are lost, including obsolete messages in gettext files. The oddities required by our various file formats are encapsulated within
set_translations()
inpontoon.sync.core.translations_to_repo
.Dropping all serialization concerns from
pontoon.sync.formats
allows for the remaining code to be significantly simplified, removing e.g. the need to parse the source file when parsing a target file. TheParsedResource
class and its subclasses are dropped, andVCSTranslation
is no longer subclassed for each format.