-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Implemented i18n translations (#108)
* Implemented i18n english/french translations and language detection --------- Authored-by: Amine Ben Yedder <[email protected]>
- Loading branch information
Showing
41 changed files
with
631 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"lokalise.i18n-ally" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ import { useState } from 'react'; | |
|
||
import { Formiz, useForm, useFormContext, useFormFields } from '@formiz/core'; | ||
import { isEmail } from '@formiz/validations'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { | ||
Box, | ||
Button, | ||
|
@@ -24,17 +25,18 @@ import { useToast } from '@/modules/toast/useToast'; | |
import { useDarkMode } from '@/theme/useDarkMode'; | ||
|
||
const CardInfoAuthStep = () => { | ||
const { t } = useTranslation(); | ||
const loginForm = useFormContext(); | ||
const { colorModeValue } = useDarkMode(); | ||
return ( | ||
<CardStatus type="info" title="Demo mode" mt="md"> | ||
<CardStatus type="info" title={t('login:card.title')} mt="md"> | ||
<Box flexDirection="row" alignItems="center" flexWrap="wrap"> | ||
<Text | ||
fontSize="lg" | ||
color={colorModeValue('gray.800', 'gray.50')} | ||
my="sm" | ||
> | ||
Enjoy the features! You can sign in with{' '} | ||
{t('login:card.description')}{' '} | ||
</Text> | ||
<TouchableOpacity | ||
onPress={() => loginForm.setValues({ email: '[email protected]' })} | ||
|
@@ -54,6 +56,7 @@ const CardInfoAuthStep = () => { | |
}; | ||
|
||
const Login = () => { | ||
const { t } = useTranslation(); | ||
const loginForm = useForm<{ | ||
email: string; | ||
code: string; | ||
|
@@ -87,7 +90,7 @@ const Login = () => { | |
validateEmailCodeModal.onOpen(); | ||
}, | ||
onError: (err) => { | ||
showError('Failed to log in. Please try again'); | ||
showError(t('login:feedbacks.error')); | ||
console.error('Authentication error:', err); | ||
}, | ||
}); | ||
|
@@ -96,14 +99,14 @@ const Login = () => { | |
useAuthLoginValidate(emailToken as string, { | ||
onSuccess: () => { | ||
validateEmailCodeModal.onClose(); | ||
showSuccess('Successfully logged in'); | ||
showSuccess(t('login:validation.success')); | ||
}, | ||
onError: () => { | ||
emailValidationCodeForm.setValues({ | ||
code: null, | ||
}); | ||
emailValidationCodeForm.setErrors({ | ||
code: 'Code is incorrect, please try again', | ||
code: t('login:validation.error'), | ||
}); | ||
}, | ||
}); | ||
|
@@ -114,9 +117,14 @@ const Login = () => { | |
<Content> | ||
<FieldInput | ||
name="email" | ||
label="Mail address" | ||
required="Mail is required" | ||
validations={[{ handler: isEmail(), message: 'Mail is invalid' }]} | ||
label={t('login:input.label')} | ||
required={t('login:input.required')} | ||
validations={[ | ||
{ | ||
handler: isEmail(), | ||
message: t('login:input.validations.email'), | ||
}, | ||
]} | ||
componentProps={{ | ||
autoCapitalize: 'none', | ||
keyboardType: 'email-address', | ||
|
@@ -133,7 +141,7 @@ const Login = () => { | |
colorScheme="brand" | ||
full | ||
> | ||
Sign in | ||
{t('login:actions.login')} | ||
</Button> | ||
</Footer> | ||
</Formiz> | ||
|
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,7 +1,12 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { Stack } from '@/layout/Stack'; | ||
|
||
const AccountStack = () => { | ||
return <Stack screens={[{ route: 'index', title: 'Account' }]} />; | ||
const { t } = useTranslation(); | ||
return ( | ||
<Stack screens={[{ route: 'index', title: t('layouts:tabs.account') }]} /> | ||
); | ||
}; | ||
|
||
export default AccountStack; |
Oops, something went wrong.