Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
readability improvement
Browse files Browse the repository at this point in the history
Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry Archibald authored and Kerry committed Dec 10, 2021
1 parent bc41cc5 commit 3140809
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/languageHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export function _td(s: string): string { // eslint-disable-line @typescript-esli
* */
const translateWithFallback = (text: string, options?: object): { translated?: string, isFallback?: boolean } => {
const translated = counterpart.translate(text, options);
if (!/^missing translation:/.test(translated)) {
return { translated };
if (/^missing translation:/.test(translated)) {
const fallbackTranslated = counterpart.translate(text, { ...options, fallbackLocale: FALLBACK_LOCALE });
return { translated: fallbackTranslated, isFallback: true };
}
const fallbackTranslated = counterpart.translate(text, { ...options, fallbackLocale: FALLBACK_LOCALE });
return { translated: fallbackTranslated, isFallback: true };
return { translated };
};

// Wrapper for counterpart's translation function so that it handles nulls and undefineds properly
Expand Down

0 comments on commit 3140809

Please sign in to comment.