Skip to content

Commit

Permalink
fix(update): added i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Aug 5, 2024
1 parent 76d1e1e commit 429fe90
Show file tree
Hide file tree
Showing 75 changed files with 1,794 additions and 2,499 deletions.
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ export default withNuxt({
],
'vue/multi-word-component-names': 'off'
}
}).prepend(pluginSecurity.configs.recommended, eslintPluginPrettierRecommended);
})
.prepend(pluginSecurity.configs.recommended, eslintPluginPrettierRecommended)
.remove('nuxt/import-globals');
12 changes: 12 additions & 0 deletions i18n.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { i18nMessageDe, i18nMessageEn } from './src/globals/locales';

export const DEFAULT_LOCALE = 'en';

export default {
legacy: false,
locale: DEFAULT_LOCALE,
messages: {
en: i18nMessageEn,
de: i18nMessageDe
}
};
36 changes: 31 additions & 5 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'pathe';
import { defineNuxtConfig } from 'nuxt/config';
import svgLoader from 'vite-svg-loader';
import * as postcssFunctions from './src/globals/postcss/functions';
import { DEFAULT_LOCALE } from './i18n.config';

const isDev = process.env.NODE_ENV === 'development';

Expand All @@ -14,6 +15,14 @@ export default defineNuxtConfig(() => {

css: ['@/assets/css/vars.css'],

compatibilityDate: '2024-08-01',

devtools: { enabled: false },

imports: {
autoImport: false
},

site: {
indexable: false,
trailingSlash: true,
Expand Down Expand Up @@ -121,6 +130,26 @@ export default defineNuxtConfig(() => {
order: 'cssnanoLast'
},

i18n: {
baseUrl: getWebsiteHost(),
locales: [
{
code: 'de',
iso: 'de-DE'
},
{
code: 'en',
iso: 'en-EN'
}
],
detectBrowserLanguage: {
useCookie: false
},
defaultLocale: DEFAULT_LOCALE,
strategy: 'prefix_except_default',
vueI18n: './i18n.config.js'
},

image: {
// The screen sizes predefined by `@nuxt/image`:
screens: {
Expand Down Expand Up @@ -260,6 +289,7 @@ export default defineNuxtConfig(() => {
'@nuxtjs/seo',
'@nuxt/content',
'@pinia/nuxt',
'@nuxtjs/i18n',
'nuxt-booster'
],

Expand All @@ -271,11 +301,7 @@ export default defineNuxtConfig(() => {
});

function getWebsiteHost() {
return (
process.env.npm_config_website_host ||
process.env.WEBSITE_HOST ||
'http://localhost:8050'
);
return process.env.npm_config_website_host || process.env.WEBSITE_HOST;
}

function getBaseUrl() {
Expand Down
Loading

0 comments on commit 429fe90

Please sign in to comment.