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 60e017b commit 2b5fd19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/package/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,7 @@ ${ JSON.stringify( message.translations, null, 4 ) }
message.isFuzzy = false;
message.setTranslations( translatedMessage.translations );
}
else if ( cloudTranslationApi ) {
if ( message.isTranslated ) continue;

if ( message.pluralId ) continue;

else if ( cloudTranslationApi && !message.translations?.[ 0 ] ) {
const res = await cloudTranslationApi.translate( poFile.language, message.id );

// error
Expand All @@ -247,7 +243,11 @@ ${ JSON.stringify( message.translations, null, 4 ) }
// translated from clous
else {
message.isFuzzy = true;
message.setTranslations( [ res.data ] );

const translations = message.translations || [];
translations[ 0 ] = res.data;

message.setTranslations( translations );

console.log( `Cloud translation:
- [en]: ${ message.id }
Expand Down

0 comments on commit 2b5fd19

Please sign in to comment.