Skip to content

Commit

Permalink
fix: tramslations
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Feb 14, 2024
1 parent 8deff0a commit a585f69
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/package/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export default class {
}

// XXX
if ( message.pluralId && translatedMessage.pluralId && message.pluralId !== translatedMessage.pluralId ) {
if ( message.pluralId && translatedMessage.msgid_plural && message.pluralId !== translatedMessage.msgid_plural ) {
console.error( `Plural form conflict found` );

process.exit( 1 );
Expand All @@ -290,13 +290,20 @@ ${ JSON.stringify( message.translations, null, 4 ) }
const choise = await utils.confirm( "What translations do you want to use?", [ "n", "o" ] );

if ( choise === "n" ) {
if ( !message.pluralId ) {
translatedMessage.translations[ 0 ] = message.translations[ 0 ];
}
else {
translatedMessage.translations = message.translations;
}

// XXX
this.#storeMessage( poFile.language, message );
this.#storeMessage( poFile.language, {
"id": translatedMessage.msgid,
"pluralId": translatedMessage.msgid_plural,
"translations": translatedMessage.translations,
} );
}
else {

// XXX
message.setTranslations( translatedMessage.translations );
}
}
Expand Down

0 comments on commit a585f69

Please sign in to comment.