Skip to content

Commit

Permalink
Bug 1382538: Run FTL translation through FluentSerializer
Browse files Browse the repository at this point in the history
Before writing translation submitted via Pontoon to the DB, run them
through the FluentSerializer for consistency with Python Serializer.
That way translation doesn't get reimported on next sync, because it
appears exactly the same when read from the DB and VCS.
  • Loading branch information
mathjazz committed Jul 20, 2017
1 parent f8f6c41 commit 4acb5b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pontoon/base/static/js/fluent_interface.js
@@ -1,6 +1,7 @@
/* Public functions used across different files */
var Pontoon = (function (my) {
const fluentParser = new FluentSyntax.FluentParser({ withSpans: false });
const fluentSerializer = new FluentSyntax.FluentSerializer();

return $.extend(true, my, {
fluent: {
Expand Down Expand Up @@ -277,7 +278,8 @@ var Pontoon = (function (my) {
translation = ' = ' + translation;
}

return entity.key + translation + '\n';
var content = entity.key + translation;
return fluentSerializer.serializeEntry(fluentParser.parseEntry(content));
},


Expand Down

0 comments on commit 4acb5b3

Please sign in to comment.