diff --git a/package-lock.json b/package-lock.json index 4ca4615..2898d48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2167,6 +2167,7 @@ "version": "11.4.4", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-11.4.4.tgz", "integrity": "sha512-gIbXVSFQV4jcSJxfwdZ5zSZmZ+12CnX0K3vBkRSd6Zn+HSzCp+QwUgPwpD/uN0oKNKI9RzlUXPKVedEuMgNG0A==", + "license": "MIT", "dependencies": { "@intlify/core-base": "11.4.4", "@intlify/devtools-types": "11.4.4", diff --git a/src/features/i18n/components/LanguageSwitchButton.vue b/src/features/i18n/components/LanguageSwitchButton.vue new file mode 100644 index 0000000..7e30294 --- /dev/null +++ b/src/features/i18n/components/LanguageSwitchButton.vue @@ -0,0 +1,151 @@ + + + + + + + \ No newline at end of file diff --git a/src/features/nav/components/Navbar.vue b/src/features/nav/components/Navbar.vue index 4b6843b..409f71f 100644 --- a/src/features/nav/components/Navbar.vue +++ b/src/features/nav/components/Navbar.vue @@ -16,19 +16,23 @@ limitations under the License. + @@ -46,6 +50,7 @@ import logo from '@/assets/logo.svg'; list-style: none; margin: 0; padding: 0; + align-items: center; } .global-nav .right-links a { diff --git a/src/i18n.js b/src/i18n.js index 81765a0..a57766b 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -19,8 +19,17 @@ import getCurrentLanguage from './utils/currentLanguage'; export const fallbackLocale = 'en'; -const SUPPORTED_LANGUAGES = [ - 'en' + +export const LANGUAGES_RTL = [ + 'ar' +]; +export const SUPPORTED_LANGUAGES = [ + 'en', + 'de', + 'fr', + 'es', + 'it', + 'pt' ]; export const i18n = createI18n({ diff --git a/src/locales/de.json b/src/locales/de.json new file mode 100644 index 0000000..2474905 --- /dev/null +++ b/src/locales/de.json @@ -0,0 +1,40 @@ +{ + "search": { + "searchBar": { + "submit": "Suchen", + "placeholder": "Suchen..." + }, + "error": { + "searchNotAvailable": "Die Suche ist momentan nicht verfügbar." + } + }, + "error": { + "tryAgainToAnotherTime": "Bitte versuchen Sie es zu einem anderen Zeitpunkt erneut.", + "pageNotFound": "Die gesuchte Seite existiert nicht. Bitte überprüfen Sie die URL oder kehren Sie zur Suchseite zurück." + }, + "links": { + "back": { + "search": "Zurück zur Suche" + } + }, + "preferences": { + "colorScheme": { + "switch": { + "light": "Zum hellen Modus wechseln", + "dark": "Zum dunklen Modus wechseln", + "auto": "Zum System-Farbschema wechseln" + } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } + } + }, + "slogan": "Gebaut zum Suchen." +} \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index f8eeea9..a55a928 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -24,6 +24,16 @@ "dark": "Switch to dark mode", "auto": "Switch to the system color scheme" } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } } }, "slogan": "Built to search." diff --git a/src/locales/es.json b/src/locales/es.json new file mode 100644 index 0000000..c5775bd --- /dev/null +++ b/src/locales/es.json @@ -0,0 +1,40 @@ +{ + "search": { + "searchBar": { + "submit": "Buscar", + "placeholder": "Buscar..." + }, + "error": { + "searchNotAvailable": "La búsqueda no está disponible en este momento." + } + }, + "error": { + "tryAgainToAnotherTime": "Por favor, inténtalo de nuevo más tarde.", + "pageNotFound": "La página que buscas no existe. Comprueba la URL o vuelve a la página de búsqueda." + }, + "links": { + "back": { + "search": "Volver a la búsqueda" + } + }, + "preferences": { + "colorScheme": { + "switch": { + "light": "Cambiar al modo claro", + "dark": "Cambiar al modo oscuro", + "auto": "Usar el esquema de color del sistema" + } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } + } + }, + "slogan": "Hecho para buscar." +} \ No newline at end of file diff --git a/src/locales/fr.json b/src/locales/fr.json new file mode 100644 index 0000000..050eeee --- /dev/null +++ b/src/locales/fr.json @@ -0,0 +1,40 @@ +{ + "search": { + "searchBar": { + "submit": "Rechercher", + "placeholder": "Rechercher..." + }, + "error": { + "searchNotAvailable": "La recherche n'est pas disponible pour le moment." + } + }, + "error": { + "tryAgainToAnotherTime": "Veuillez réessayer ultérieurement.", + "pageNotFound": "La page que vous recherchez n'existe pas. Vérifiez l'URL ou retournez à la page de recherche." + }, + "links": { + "back": { + "search": "Retour à la recherche" + } + }, + "preferences": { + "colorScheme": { + "switch": { + "light": "Passer en mode clair", + "dark": "Passer en mode sombre", + "auto": "Utiliser le thème système" + } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } + } + }, + "slogan": "Conçu pour chercher." +} \ No newline at end of file diff --git a/src/locales/it.json b/src/locales/it.json new file mode 100644 index 0000000..2b6d8c1 --- /dev/null +++ b/src/locales/it.json @@ -0,0 +1,40 @@ +{ + "search": { + "searchBar": { + "submit": "Cerca", + "placeholder": "Cerca..." + }, + "error": { + "searchNotAvailable": "La ricerca non è disponibile al momento." + } + }, + "error": { + "tryAgainToAnotherTime": "Per favore riprova più tardi.", + "pageNotFound": "La pagina che cerchi non esiste. Controlla l'URL o torna alla pagina di ricerca." + }, + "links": { + "back": { + "search": "Torna alla ricerca" + } + }, + "preferences": { + "colorScheme": { + "switch": { + "light": "Passa alla modalità chiara", + "dark": "Passa alla modalità scura", + "auto": "Usa la combinazione colori di sistema" + } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } + } + }, + "slogan": "Costruito per cercare." +} \ No newline at end of file diff --git a/src/locales/pt.json b/src/locales/pt.json new file mode 100644 index 0000000..a5a03d4 --- /dev/null +++ b/src/locales/pt.json @@ -0,0 +1,40 @@ +{ + "search": { + "searchBar": { + "submit": "Pesquisar", + "placeholder": "Pesquisar..." + }, + "error": { + "searchNotAvailable": "A pesquisa não está disponível no momento." + } + }, + "error": { + "tryAgainToAnotherTime": "Por favor, tente novamente mais tarde.", + "pageNotFound": "A página que você procura não existe. Verifique o URL ou volte à página de pesquisa." + }, + "links": { + "back": { + "search": "Voltar à pesquisa" + } + }, + "preferences": { + "colorScheme": { + "switch": { + "light": "Mudar para modo claro", + "dark": "Mudar para modo escuro", + "auto": "Usar esquema de cores do sistema" + } + }, + "locale": { + "languages": { + "en": "English", + "de": "Deutsch", + "fr": "Français", + "es": "Español", + "it": "Italiano", + "pt": "Português" + } + } + }, + "slogan": "Feito para pesquisar." +} \ No newline at end of file diff --git a/src/utils/currentLanguage.js b/src/utils/currentLanguage.js index 9aabb16..4d568e6 100644 --- a/src/utils/currentLanguage.js +++ b/src/utils/currentLanguage.js @@ -15,6 +15,8 @@ limitations under the License. */ export default function getCurrentLanguage () { + const saved = localStorage.getItem('locale'); + if (saved) return saved; const locale = new Intl.Locale(navigator.language); return locale.language; }; \ No newline at end of file