-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(i18n): remove the use of <FormattedMesage> on outer components
- Loading branch information
Showing
7 changed files
with
63 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
import { FormattedMessage } from 'react-intl' | ||
import { useContext } from 'react' | ||
|
||
import { PATHS } from '~/common/enums' | ||
import { Button, TextIcon } from '~/components' | ||
|
||
export const BackToHomeButton = () => ( | ||
<Button size={['10.5rem', '2.25rem']} bgColor="green" href={PATHS.HOME}> | ||
<TextIcon color="white" weight="medium"> | ||
<FormattedMessage defaultMessage="Back to discovery" id="HEpsZ3" /> | ||
</TextIcon> | ||
</Button> | ||
) | ||
import { Button, LanguageContext, TextIcon } from '~/components' | ||
import { UserLanguage } from '~/gql/graphql' | ||
|
||
export const BackToHomeButton = () => { | ||
const { lang } = useContext(LanguageContext) | ||
|
||
// FIXME: cannot use <FormattedMessage> here cuz it's outer of <TranslationProvider> | ||
const text = | ||
lang === UserLanguage.En | ||
? 'Back to discovery' | ||
: lang === UserLanguage.ZhHans | ||
? '返回发现' | ||
: '返回發現' | ||
|
||
return ( | ||
<Button size={['10.5rem', '2.25rem']} bgColor="green" href={PATHS.HOME}> | ||
<TextIcon color="white" weight="medium"> | ||
{text} | ||
</TextIcon> | ||
</Button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters