Skip to content

Commit

Permalink
Flatten Fluent message when copying from original (mozilla#2376)
Browse files Browse the repository at this point in the history
And when set externally as string
  • Loading branch information
eemeli authored Nov 29, 2021
1 parent c9d2610 commit b2bf96d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function RichEditor(props: Props): React.ReactElement<any> {
if (syntax !== 'rich') {
return;
}
updateTranslation(message, changeSource);
updateTranslation(fluent.flattenMessage(message), changeSource);
}
}, [translation, changeSource, updateTranslation, dispatch]);

Expand All @@ -64,7 +64,8 @@ export default function RichEditor(props: Props): React.ReactElement<any> {

function copyOriginalIntoEditor() {
if (entity) {
updateTranslation(fluent.parser.parseEntry(entity.original));
const origMsg = fluent.parser.parseEntry(entity.original);
updateTranslation(fluent.flattenMessage(origMsg));
}
}

Expand Down

0 comments on commit b2bf96d

Please sign in to comment.