From 93037f92e604b3b311f246d294a3b163f8c2a1b5 Mon Sep 17 00:00:00 2001 From: zdm Date: Fri, 16 Feb 2024 17:50:00 +0200 Subject: [PATCH] fix: translations --- lib/commands/localization/update.js | 5 ++++- lib/get-text.js | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/commands/localization/update.js b/lib/commands/localization/update.js index ffd72c8d..63630f2e 100644 --- a/lib/commands/localization/update.js +++ b/lib/commands/localization/update.js @@ -8,7 +8,10 @@ export default class extends Command { // public async run () { - const rootPackage = this._findRootPackage(); + + // XXX if root not founsd - start from the current dir + // const rootPackage = this._findRootPackage(); + const rootPackage = this._findNearestPackage(); if ( !rootPackage ) this._throwError( `Unable to find root package` ); diff --git a/lib/get-text.js b/lib/get-text.js index 41d88448..570d48e9 100644 --- a/lib/get-text.js +++ b/lib/get-text.js @@ -256,7 +256,16 @@ export default class GetText { const plural = this.#parseMessage( node.arguments[ 1 ], { start, } ); + + // XXX if ( !plural.value ) return; + + // XXX + if ( !plural.isTemplate ) throw `Plural message must be msgid taggeed template`; + + // XXX + if ( !msgId.isTemplate ) throw `Single form message used with plurak form must be msgid taggeed template`; + message.pluralId = plural.value; if ( plural.isTemplate ) message.flags = [ "javascript-format" ]; }