Skip to content

Commit

Permalink
Added i18n to almost all strings (#273)
Browse files Browse the repository at this point in the history
* Added italian translation

* Added i18n to almost all strings

* Fix english translation

---------

Co-authored-by: loviuz <[email protected]>
Co-authored-by: bjarneo <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2024
1 parent 0e3f147 commit b221934
Show file tree
Hide file tree
Showing 17 changed files with 263 additions and 81 deletions.
82 changes: 81 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,62 @@
"sign_in": "Sign in",
"sign_out": "Sign out",
"sign_up": "Sign up",
"account": "Account",
"not_logged_in": "Not logged in",
"something_went_wrong": "Something went wrong!",
"loading": "Loading",
"account": {
"home": {
"title": "Account",
"update_password": "Update your password",
"first_time_message": "If this is the first time you sign in on this user account, you should go to Account settings and update your password",
"hi": "Hi",
"intro": "We are glad you logged in. Here is the list of features signed in users get",
"upload_files": "Upload files",
"expiration": "Expiration time of 14 and 28 days for secrets",
"secrets": "List and delete your secrets",
"more": "More features are coming! Thanks for joining Hemmelig.app!"
},
"account": {
"passwords_does_not_match": "Passwords did not match",
"can_not_update_profile": "Could not update your user profile",
"can_not_delete": "Could not delete the user",
"delete_account": "Delete your profile",
"do_you_want_delete": "Are you sure you want to delete your profile?",
"dont_delete_account": "No, don't delete it",

"email": "Email",
"your_password": "Current password",
"current_password": "Your current password",
"update_your_password": "Update your password",
"new_password": "New password",
"confirm_password": "Confirm Password",
"confirm_new_password": "Confirm your new password",
"update_details": "Update details"
},
"secrets": {
"id": "Id",
"expires": "Expires",
"public": "Public",
"delete": "Delete",
"yes": "Yes",
"no": "No",
"delete_secret": "Delete secret",
"dont_delete_secret": "No don't delete it",
"do_you_want_delete": "Are you sure you want to delete this secret?"
},
"settings": {
"read_only_mode": "Read only mode",
"readonly_only_for_non_admin": "Should the Hemmelig instance be read only for non admin users?",
"disable_users": "Disable users",
"disable_signin": "Should user sign in be disabled?",
"disable_user_account_creation": "Disable user account creation",
"disable_user_account_creation_description": "Do not allow users to create a new account. As an admin, you will still be able to create new user accounts",
"disable_file_upload": "Disable file upload",
"disable_file_upload_description": "Disable file upload for your instance",
"restrict_organization_email": "Restrict to email domain",
"restrict_organization_email_description": "This will limit user registration for a certain email domain"
}
},
"public_list": "Public pastes",
"account_settings": "Account settings",
"instance_settings": "Instance settings",
Expand Down Expand Up @@ -98,5 +153,30 @@
"expires": "Expires",
"username": "Username",
"of": "of"
},
"signout": {
"title": "Signing out",
"waiting": "Please wait"
},
"signin": {
"title": "Sign in",
"heading": "Everything you need to access, and manage the Hemmelig secrets.",
"username": "Username",
"password": "Your password",
"signup": "Sign in"
},
"signup": {
"title": "Sign up",
"heading": "Everything you need to access, and manage the Hemmelig secrets.",
"email": "Email",
"username": "Username",
"password": "Your password",
"signup": "Sign up"
},
"privacy": {
"title": "Privacy"
},
"terms": {
"title": "Terms & conditions"
}
}
82 changes: 81 additions & 1 deletion public/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,62 @@
"sign_in": "Accedi",
"sign_out": "Esci",
"sign_up": "Registrati",
"account": "Profilo",
"not_logged_in": "Non autenticatǝ",
"something_went_wrong": "Qualcosa è andato storto!",
"loading": "Caricamento",
"account": {
"home": {
"title": "Profilo",
"update_password": "Aggiorna la tua password",
"first_time_message": "Se questa è la prima volta che accedi a questo profilo, dovresti entrare su Impostazioni profilo e aggiornare la tua password",
"hi": "Ciao",
"intro": "Siamo lietɜ che tu sia entratǝ. Ecco una lista di funzionalità che hanno lɜ utentɜ autenticatɜ",
"upload_files": "Caricare file",
"expiration": "Estensione giorni di scadenza per i segreti fino a 14 e 28 giorni",
"secrets": "Visualizzare ed eliminare i tuoi segreti",
"more": "Altre funzionalità sono in arrivo! Grazie per aver scelto Hemmelig.app!"
},
"account": {
"passwords_does_not_match": "Le password non coincidono",
"can_not_update_profile": "Impossibile aggiornare il tuo profilo",
"can_not_delete": "Impossibile eliminare l'utente",
"delete_account": "Elimina profilo",
"do_you_want_delete": "Sei sicurǝ di eliminare il tuo profilo?",
"dont_delete_account": "No, non eliminarlo",

"email": "Email",
"your_password": "Password attuale",
"current_password": "La tua password attuale",
"update_your_password": "Aggiorna la tua password",
"new_password": "Nuova password",
"confirm_password": "Conferma Password",
"confirm_new_password": "Conferma la tua nuova password",
"update_details": "Aggiorna dati"
},
"secrets": {
"id": "Id",
"expires": "Scadenza",
"public": "Pubblico",
"delete": "Elimina",
"yes": "",
"no": "No",
"delete_secret": "Elimina segreto",
"dont_delete_secret": "No, non eliminarlo",
"do_you_want_delete": "Sei sicurǝ di eliminare questo segreto?"
},
"settings": {
"read_only_mode": "Modalità sola lettura",
"readonly_only_for_non_admin": "L'stanza Hemmelig può essere utilizzabile solo da utenti non amministratori?",
"disable_users": "Disabilita utenti",
"disable_signin": "L'accesso utente dovrebbe essere disabilitato?",
"disable_user_account_creation": "Disabilita la creazione di profili utente",
"disable_user_account_creation_description": "Non permettere allǝ utentǝ di creare un nuovo profilo. Come amministratore, sarai sempre in grando di creare nuovi profili utente",
"disable_file_upload": "Disabilita caricamento file",
"disable_file_upload_description": "Disabilita il caricamento di file per la tua istanza",
"restrict_organization_email": "Limita al dominio dell'email",
"restrict_organization_email_description": "Questo limiterà la registrazione utente per un certo dominio"
}
},
"public_list": "Note pubbliche",
"account_settings": "Impostazioni profilo",
"instance_settings": "Impostazioni istanza",
Expand Down Expand Up @@ -98,5 +153,30 @@
"expires": "Scadenza",
"username": "Nome utente",
"of": "di"
},
"signout": {
"title": "Uscita in corso",
"waiting": "Attendere"
},
"signin": {
"title": "Accedi",
"heading": "Tutto il necessario per accedere e gestire i segreti di Hemmelig.",
"username": "Nome utente",
"password": "La tua password",
"signin": "Accedi"
},
"signup": {
"title": "Registrati",
"heading": "Tutto il necessario per accedere e gestire i segreti di Hemmelig.",
"email": "Email",
"username": "Nome utente",
"password": "Scegli una password",
"signup": "Registrati"
},
"privacy": {
"title": "Privacy"
},
"terms": {
"title": "Termini e condizioni"
}
}
6 changes: 3 additions & 3 deletions src/client/app-shell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ApplicationShell = () => {
size="xs"
transform="uppercase"
>
{t('account')}
{t('account.home.title')}
</Anchor>
|
<Anchor
Expand All @@ -47,7 +47,7 @@ const ApplicationShell = () => {
size="xs"
transform="uppercase"
>
Privacy
{t('privacy.title')}
</Anchor>
|
<Anchor
Expand All @@ -57,7 +57,7 @@ const ApplicationShell = () => {
size="xs"
transform="uppercase"
>
Terms & Condition
{t('terms.title')}
</Anchor>
|
</>
Expand Down
6 changes: 3 additions & 3 deletions src/client/components/header/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Nav = ({ opened, toggle, isLoggedIn }) => {

navItems.push(
{
label: t('account'),
label: t('account.home.title'),
icon: <IconUser size="1rem" stroke={1.5} />,
component: Link,
onClick: toggle,
Expand All @@ -59,14 +59,14 @@ const Nav = ({ opened, toggle, isLoggedIn }) => {

if (isMobile) {
navItems.push({
label: 'Privacy',
label: t('privacy.title'),
icon: <IconFingerprint size="1rem" stroke={1.5} />,
component: Link,
onClick: toggle,
to: '/privacy',
});
navItems.push({
label: 'Terms & Condition',
label: t('terms.title'),
icon: <IconList size="1rem" stroke={1.5} />,
component: Link,
onClick: toggle,
Expand Down
7 changes: 6 additions & 1 deletion src/client/components/settings/main-links.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ export default function MainLinks() {
const { t } = useTranslation();

const data = [
{ icon: <IconUser size="1rem" />, color: 'blue', label: t('account'), route: 'account' },
{
icon: <IconUser size="1rem" />,
color: 'blue',
label: t('account.home.title'),
route: 'account',
},
{
icon: <IconLock size="1rem" />,
color: 'teal',
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/settings/secondary-links.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export default function SecondaryLinks() {
route: '/public',
},
{
label: 'Privacy',
label: t('privacy.title'),
icon: <IconFingerprint size="1rem" stroke={1.5} />,
route: '/account/privacy',
},
{
label: 'Terms & Condition',
label: t('terms.title'),
icon: <IconList size="1rem" stroke={1.5} />,
route: '/account/terms',
},
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/spinner/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import style from './style.module.css';

const Spinner = () => <div className={style.loader}>Loading...</div>;
const Spinner = () => <div className={style.loader}>{t('loading')}...</div>;

export default Spinner;
39 changes: 22 additions & 17 deletions src/client/routes/account/account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Account = () => {
},
validate: {
confirmNewPassword: (value, values) =>
value !== values.newPassword ? 'Passwords did not match' : null,
value !== values.newPassword ? t('account.account.passwords_does_not_match') : null,
},
});

Expand All @@ -50,7 +50,7 @@ const Account = () => {
const userInfo = await getUser();

if (userInfo.error || [401, 500].includes(userInfo.statusCode)) {
setUserError(userInfo.error ? userInfo.error : 'Not logged in');
setUserError(userInfo.error ? userInfo.error : t('not_logged_in'));

return;
}
Expand All @@ -77,7 +77,7 @@ const Account = () => {
setError(
updatedUserInfo.error
? updatedUserInfo.error
: 'Could not update your user profile'
: t('account.account.can_not_update_profile')
);

return;
Expand Down Expand Up @@ -114,7 +114,9 @@ const Account = () => {

if (deletedUserInfo.error || [401, 500].includes(deletedUserInfo.statusCode)) {
setError(
deletedUserInfo.error ? deletedUserInfo.error : 'Could not delete the user'
deletedUserInfo.error
? deletedUserInfo.error
: t('account.account.can_not_delete')
);

return;
Expand All @@ -134,10 +136,13 @@ const Account = () => {

const openDeleteModal = () =>
openConfirmModal({
title: 'Delete your profile',
title: t('account.accounts.delete_account'),
centered: true,
children: <Text size="sm">Are you sure you want to delete your profile?</Text>,
labels: { confirm: 'Delete account', cancel: "No don't delete it" },
children: <Text size="sm">{t('account.account.do_you_want_delete')}</Text>,
labels: {
confirm: t('account.account.delete_account'),
cancel: t('account.account.dont_delete_account'),
},
confirmProps: { color: 'red' },
onConfirm: () => onDeleteUser(),
});
Expand Down Expand Up @@ -170,30 +175,30 @@ const Account = () => {
<Group position="right" grow>
<Stack className={style.width}>
<TextInput
label="Email"
label={t('account.account.email')}
icon={<IconAt size={14} />}
placeholder="Email"
placeholder={t('account.account.email')}
{...form.getInputProps('email')}
/>

<PasswordInput
label="Current password"
label={t('account.account.your_password')}
icon={<IconLock size={14} />}
placeholder="Your current password"
placeholder={t('account.account.current_password')}
{...form.getInputProps('currentPassword')}
/>

<PasswordInput
label="New password"
label={t('account.account.new_password')}
icon={<IconLock size={14} />}
placeholder="Update your password"
placeholder={t('account.account.update_your_password')}
{...form.getInputProps('newPassword')}
/>

<PasswordInput
label="Confirm Password"
label={t('account.account.confirm_password')}
icon={<IconLock size={14} />}
placeholder="Confirm your new password"
placeholder={t('account.account.confirm_new_password')}
{...form.getInputProps('confirmNewPassword')}
/>
</Stack>
Expand All @@ -206,15 +211,15 @@ const Account = () => {
onClick={openDeleteModal}
leftIcon={<IconTrash size={14} />}
>
Delete profile
{t('account.account.delete_account')}
</Button>

<Button
leftIcon={<IconEdit size={14} />}
onClick={onProfileUpdate}
color="hemmelig"
>
Update details
{t('account.account.update_details')}
</Button>
</Group>
</Stack>
Expand Down
Loading

0 comments on commit b221934

Please sign in to comment.