Skip to content

Commit

Permalink
feat: add auth frontend translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed May 13, 2022
1 parent fe4cca5 commit e619850
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/constants/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const AUTH = {
SIGN_IN_BUTTON: 'Sign In',
SIGN_IN_HEADER: 'Sign In',
SIGN_UP_LINK_TEXT: 'Not registered? Click here to register',
SIGN_IN_LINK_TEXT: 'Already have an account? Click here to sign in',
EMAIL_SIGN_IN_METHOD: 'Email Sign In',
PASSWORD_SIGN_IN_METHOD: 'Password Sign In',
NAME_FIELD_LABEL: 'Name',
SIGN_UP_BUTTON: 'Sign Up',
SIGN_UP_HEADER: 'Sign Up',
EMAIL_FIELD_TEXT: 'Email',
};
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export {
} from './constants/messages';

export { CHATBOX } from './constants/chatbox';
export { AUTH } from './constants/auth';
export { namespaces } from './langs';
export { default, langs } from './i18n';
14 changes: 14 additions & 0 deletions src/langs/en/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { AUTH } from '../../constants/auth';

export default {
[AUTH.SIGN_IN_BUTTON]: 'Sign In',
[AUTH.SIGN_IN_HEADER]: 'Sign In',
[AUTH.SIGN_UP_LINK_TEXT]: 'Not registered? Click here to register',
[AUTH.SIGN_IN_LINK_TEXT]: 'Already have an account? Click here to sign in',
[AUTH.EMAIL_SIGN_IN_METHOD]: 'Email Sign In',
[AUTH.PASSWORD_SIGN_IN_METHOD]: 'Password Sign In',
[AUTH.NAME_FIELD_LABEL]: 'Name',
[AUTH.SIGN_UP_BUTTON]: 'Sign Up',
[AUTH.SIGN_UP_HEADER]: 'Sign Up',
[AUTH.EMAIL_FIELD_TEXT]: 'Email',
};
15 changes: 15 additions & 0 deletions src/langs/fr/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AUTH } from '../../constants/auth';

export default {
[AUTH.SIGN_IN_BUTTON]: 'Se Connecter',
[AUTH.SIGN_IN_HEADER]: 'Se Connecter',
[AUTH.SIGN_UP_LINK_TEXT]:
'Pas encore enregistré ? Cliquez ici pour vous enregistrer',
[AUTH.SIGN_IN_LINK_TEXT]: 'Déjà un compte? Cliquez ici pour vous connecter',
[AUTH.EMAIL_SIGN_IN_METHOD]: 'Connexion avec email',
[AUTH.PASSWORD_SIGN_IN_METHOD]: 'Connexion avec mot de passe',
[AUTH.NAME_FIELD_LABEL]: 'Nom',
[AUTH.SIGN_UP_BUTTON]: "S'enregistrer",
[AUTH.SIGN_UP_HEADER]: "S'enregistrer",
[AUTH.EMAIL_FIELD_TEXT]: 'Email',
};
11 changes: 8 additions & 3 deletions src/langs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@ import messagesEN from './en/messages';
import messagesFR from './fr/messages';
import chatboxEN from './en/chatbox';
import chatboxFR from './fr/chatbox';
import authEN from './en/auth';
import authFR from './fr/auth';

// define namespaces
export const namespaces = {
messages: 'messages',
auth: 'auth',
chatbox: 'chatbox',
messages: 'messages',
};

const en = {
[namespaces.messages]: messagesEN,
[namespaces.auth]: authEN,
[namespaces.chatbox]: chatboxEN,
[namespaces.messages]: messagesEN,
};

const fr = {
[namespaces.messages]: messagesFR,
[namespaces.auth]: authFR,
[namespaces.chatbox]: chatboxFR,
[namespaces.messages]: messagesFR,
};

// other supported languages here
Expand Down

0 comments on commit e619850

Please sign in to comment.