add nuxt-i18n plugin + add old en-US.json

This commit is contained in:
axolotle 2023-07-23 16:23:56 +02:00
parent 585109754c
commit 71ed6f6dad
4 changed files with 80 additions and 2 deletions

View file

@ -1,5 +1,14 @@
<script setup lang="ts">
const head = useLocaleHead({
addDirAttribute: true,
addSeoAttributes: true,
})
</script>
<template>
<div class="p-10 min-h-screen">
<Html :lang="head.htmlAttrs?.lang" :dir="head.htmlAttrs?.dir"></Html>
<div class="container mx-auto p-4">
<slot />
</div>

49
locales/en-US.json Normal file
View file

@ -0,0 +1,49 @@
{
"portal": "YunoHost Portal",
"information": "Your info",
"username": "Username",
"password": "Password",
"fullname": "Full name",
"mail_addresses": "E-mail addresses",
"mail_forward": "E-mail forwarding address",
"new_mail": "newmail{'@'}mydomain.org",
"new_forward": "newforward{'@'}myforeigndomain.org",
"add_mail": "Add an e-mail alias",
"add_forward": "Add an e-mail forwarding address",
"ok": "OK",
"cancel": "Cancel",
"change_password": "Change password",
"edit": "Edit",
"current_password": "Current password",
"new_password": "New password",
"confirm": "Confirm",
"login": "Log in",
"logout": "Log out",
"password_changed": "Password changed",
"password_changed_error": "Could not change password",
"password_not_match": "The passwords don't match",
"password_listed": "This password is among the most used passwords in the world. Please choose something a bit more unique.",
"password_too_simple_1": "The password needs to be at least 8 characters long",
"password_too_simple_2": "The password needs to be at least 8 characters long and contains digit, upper and lower characters",
"password_too_simple_3": "The password needs to be at least 8 characters long and contains digit, upper, lower and special characters",
"password_too_simple_4": "The password needs to be at least 12 characters long and contains digit, upper, lower and special characters",
"good_practices_about_user_password": "Pick a user password of at least 8 characters - though it is good practice to use longer ones (i.e. a passphrase) and/or use various kind of characters (uppercase, lowercase, digits and special characters).",
"wrong_current_password": "The current password is wrong",
"invalid_mail": "Invalid e-mail address",
"invalid_domain": "Invalid domain in",
"invalid_mailforward": "Invalid e-mail forwarding address",
"mail_already_used": "E-mail address already in use",
"information_updated": "Info updated",
"user_saving_fail": "Could not save new user info",
"missing_required_fields": "Fill in the required fields",
"wrong_username_password": "Wrong username or password",
"logged_out": "Logged out",
"please_login": "Please log in to access to this content",
"please_login_from_portal": "Please log in from the portal",
"redirection_error_invalid_url": "Redirection error: Invalid URL",
"redirection_error_unmanaged_domain": "Redirection error: Unmanaged domain",
"footerlink_edit": "Edit my profile",
"footerlink_documentation": "Documentation",
"footerlink_support": "Support",
"footerlink_administration": "Administration"
}

View file

@ -5,7 +5,12 @@ export default defineNuxtConfig({
baseURL: '/yunohost/sso',
buildAssetsDir: '/assets/',
},
modules: ['@nuxtjs/tailwindcss', 'nuxt-icon', '@nuxtjs/google-fonts'],
modules: [
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'nuxt-icon',
'@nuxtjs/google-fonts',
],
devtools: { enabled: true },
googleFonts: {
families: {
@ -17,4 +22,18 @@ export default defineNuxtConfig({
apiIp: '', // overridden by NUXT_PUBLIC_API_IP environment variable
},
},
i18n: {
locales: [
{
code: 'en-US',
iso: 'en-US',
name: 'English (United States)',
file: 'en-US.json',
},
],
lazy: true,
langDir: 'locales',
defaultLocale: 'en-US',
strategy: 'no_prefix',
},
})

View file

@ -6,7 +6,7 @@
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint:js": "eslint --ext \".ts,.vue\" --ignore-path .gitignore .",
"lint:js": "eslint --ext \".ts,.vue,.cjs,.js\" --ignore-path .gitignore .",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:js && yarn lint:prettier",
"lintfix": "prettier --write --list-different . && yarn lint:js --fix"
@ -15,6 +15,7 @@
"@nuxt/devtools": "latest",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@nuxtjs/google-fonts": "^3.0.1",
"@nuxtjs/i18n": "^8.0.0-beta.13",
"@nuxtjs/tailwindcss": "^5.3.5",
"@types/node": "^18.16.19",
"@typescript-eslint/parser": "^6.1.0",