Skip to content

Commit

Permalink
Skip undefined keywords (#793)
Browse files Browse the repository at this point in the history
* Skip undefined keywords for translations

* Filter undefined name and desc
  • Loading branch information
aidenaio authored May 24, 2022
1 parent 9a9ac34 commit 4fc5c9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion renderer/screens/flips/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ export function FlipKeywordTranslationSwitch({
/>
) : null}
<GoogleTranslateButton
phrases={keywords.words.map(({name, desc}) => `${name}\n${desc}`)}
phrases={keywords.words.map(({name, desc}) =>
[name, desc].filter(Boolean).join('\n')
)}
locale={locale}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion renderer/shared/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ export function ExternalLink({

export function GoogleTranslateButton({
phrases = [],
text = encodeURIComponent(phrases.join('\n\n')),
text = encodeURIComponent(phrases.filter(Boolean).join('\n\n')),
locale = global.locale,
children,
...props
Expand Down

0 comments on commit 4fc5c9a

Please sign in to comment.