Skip to content

Commit

Permalink
fix: translations
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Feb 17, 2024
1 parent 2954bc0 commit f7f63b3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/package/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ export default class {
if ( message.isDisabled ) continue;

// delete invalid translation
if ( message.id === message.singleFormTranslation ) {
if ( message.id === message.singularTranslation ) {
console.warn( `Failed translation removed:
[en] message:
${ message.id }
[${ poFile.language }] translation:
${ message.singleFormTranslation }
${ message.singularTranslation }
` );

message.isFuzzy = false;
Expand Down Expand Up @@ -198,8 +198,8 @@ ${ message.singleFormTranslation }
message.setTranslations( translatedMessage.translations );
}

// pre-translate single form
else if ( cloudTranslationApi && !message.isSingleFormTranslated ) {
// pre-translate singular form
else if ( cloudTranslationApi && !message.isSingularTranslated ) {
await this.#preTranslate( poFile, message );
}
}
Expand Down Expand Up @@ -247,7 +247,7 @@ ${ message.id }
// translated from clous
else {
message.isFuzzy = true;
message.setSingleFormTranslation( res.data );
message.setSingularTranslation( res.data );

console.log( `Cloud translation:
Expand Down Expand Up @@ -282,20 +282,20 @@ ${ JSON.stringify( message.translations, null, 4 ) }
` );
}

// single form
// singular form
else {
if ( message.singleFormTranslation === translatedMessage.translations[ message.singleFormIndex ] ) return;
if ( message.singularTranslation === translatedMessage.translations[ message.singularIndex ] ) return;

console.log( `Translation memory conflict found:
[en] message:
${ message.id }
[${ poFile.language }]: old translations:
${ translatedMessage.translations[ message.singleFormIndex ] }
${ translatedMessage.translations[ message.singularIndex ] }
[${ poFile.language }]: new translations:
${ message.singleFormTranslation }
${ message.singularTranslation }
` );
}

Expand All @@ -306,9 +306,9 @@ ${ message.singleFormTranslation }
}
else if ( answer === "new" ) {

// merge single form
// merge singular form
if ( !message.pluralId ) {
translatedMessage.translations[ message.singleFormIndex ] = message.singleFormTranslation;
translatedMessage.translations[ message.singularIndex ] = message.singularTranslation;
}

// merge plural foel
Expand Down

0 comments on commit f7f63b3

Please sign in to comment.