diff --git a/lib/get-text.js b/lib/get-text.js index c66e9e64..c08b0b54 100644 --- a/lib/get-text.js +++ b/lib/get-text.js @@ -136,10 +136,10 @@ export default class GetText { #parseYaml ( content ) { const locale = { - "l10n": ( single, plural, pluralNumber ) => { - if ( single ) { + "l10n": ( singular, plural, pluralNumber ) => { + if ( singular ) { this.#poFile.addEctractedMessages( { - [ single ]: { + [ singular ]: { "references": [ this.#relativePath ], }, } ); @@ -155,10 +155,10 @@ export default class GetText { } }, - "l10nt": ( single, plural, pluralNumber ) => { - if ( single ) { + "l10nt": ( singular, plural, pluralNumber ) => { + if ( singular ) { this.#poFile.addEctractedMessages( { - [ single ]: { + [ singular ]: { "references": [ this.#relativePath ], }, } ); @@ -255,7 +255,7 @@ export default class GetText { // not a supported function / method name if ( method !== "l10n" && method !== "l10nt" ) return; - var single = { + const singular = { "id": null, "flags": null, "references": null, @@ -273,13 +273,13 @@ export default class GetText { } ); if ( message.value ) { - single.id = message.value; + singular.id = message.value; - if ( message.isTemplate ) single.flags = [ "javascript-format" ]; + if ( message.isTemplate ) singular.flags = [ "javascript-format" ]; // references const { line, column } = this.#getNodeLocation( node.arguments[ 0 ], { start } ); - single.references = [ `${ this.#relativePath }:${ line }:${ column }` ]; + singular.references = [ `${ this.#relativePath }:${ line }:${ column }` ]; } // plural @@ -300,15 +300,15 @@ export default class GetText { } } - if ( !single.id && !plural.id ) return; + if ( !singular.id && !plural.id ) return; // extracted comments const extractedComments = this.#extractNodeComment( ast, node ); - if ( single.id ) { + if ( singular.id ) { this.#poFile.addEctractedMessages( { - [ single.id ]: { - ...single, + [ singular.id ]: { + ...singular, extractedComments, }, } );