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 0fdeb96 commit 4b08b3d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/package/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ ${ JSON.stringify( message.translations, null, 4 ) }
}

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

// error
Expand All @@ -245,11 +245,7 @@ ${ JSON.stringify( message.translations, null, 4 ) }
// translated from clous
else {
message.isFuzzy = true;

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

message.setTranslations( translations );
message.setSingleFormTranslation( res.data );

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

0 comments on commit 4b08b3d

Please sign in to comment.