diff --git a/packages/localize/src/tools/src/extract/translation_files/arb_translation_serializer.ts b/packages/localize/src/tools/src/extract/translation_files/arb_translation_serializer.ts index c0b6d314d3..1a5d79a400 100644 --- a/packages/localize/src/tools/src/extract/translation_files/arb_translation_serializer.ts +++ b/packages/localize/src/tools/src/extract/translation_files/arb_translation_serializer.ts @@ -50,7 +50,8 @@ export class ArbTranslationSerializer implements TranslationSerializer { const id = getMessageId(message); output += this.serializeMessage(id, message); output += this.serializeMeta( - id, message.description, duplicateMessages.filter(hasLocation).map(m => m.location)); + id, message.description, message.meaning, + duplicateMessages.filter(hasLocation).map(m => m.location)); } output += '\n}'; @@ -62,14 +63,19 @@ export class ArbTranslationSerializer implements TranslationSerializer { return `,\n ${JSON.stringify(id)}: ${JSON.stringify(message.text)}`; } - private serializeMeta(id: string, description: string|undefined, locations: ɵSourceLocation[]): - string { + private serializeMeta( + id: string, description: string|undefined, meaning: string|undefined, + locations: ɵSourceLocation[]): string { const meta: string[] = []; if (description) { meta.push(`\n "description": ${JSON.stringify(description)}`); } + if (meaning) { + meta.push(`\n "x-meaning": ${JSON.stringify(meaning)}`); + } + if (locations.length > 0) { let locationStr = `\n "x-locations": [`; for (let i = 0; i < locations.length; i++) { diff --git a/packages/localize/src/tools/test/extract/translation_files/arb_translation_serializer_spec.ts b/packages/localize/src/tools/test/extract/translation_files/arb_translation_serializer_spec.ts index e93925dffa..f2c7103a8a 100644 --- a/packages/localize/src/tools/test/extract/translation_files/arb_translation_serializer_spec.ts +++ b/packages/localize/src/tools/test/extract/translation_files/arb_translation_serializer_spec.ts @@ -64,7 +64,8 @@ runInEachFileSystem(() => { ' "13579": "{$START_BOLD_TEXT}b{$CLOSE_BOLD_TEXT}",', ' "24680": "a",', ' "@24680": {', - ' "description": "and description"', + ' "description": "and description",', + ' "x-meaning": "meaning"', ' },', ' "80808": "multi\\nlines",', ' "90000": "",', @@ -72,6 +73,7 @@ runInEachFileSystem(() => { ' "100001": "{VAR_PLURAL, plural, one {{START_BOLD_TEXT}something bold{CLOSE_BOLD_TEXT}} other {pre {START_TAG_SPAN}middle{CLOSE_TAG_SPAN} post}}",', ' "12345": "a{$PH}b{$PH_1}c",', ' "@12345": {', + ' "x-meaning": "some meaning",', ' "x-locations": [', ' {', ' "file": "file.ts",',