Skip to content

Commit

Permalink
chore: upgrade i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Nov 24, 2024
1 parent 30c742b commit ae36f75
Show file tree
Hide file tree
Showing 8 changed files with 5,374 additions and 3,866 deletions.
5 changes: 3 additions & 2 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/chai": "4.3.20",
"browserstack-local": "1.5.5",
"chai": "4.5.0",
"codeceptjs": "3.6.5",
"codeceptjs": "3.6.7",
"dotenv": "16.4.5",
"jwt-decode": "4.0.0",
"totp-generator": "1.0.0",
Expand All @@ -22,5 +22,6 @@
},
"devDependencies": {
"codeceptjs-bshelper": "3.1.3"
}
},
"packageManager": "[email protected]+sha256.06e65a4965baff6d6097f9c8f75c35f6d420974dbc03d775009056a69edfd271"
}
8,984 changes: 5,234 additions & 3,750 deletions e2e/pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions frontend/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ export default defineNuxtConfig({
vueI18n: "./src/i18n/i18n.config.ts",
strategy: "no_prefix",
lazy: true,
langDir: "./i18n/locales/processed",
langDir: "../src/i18n/locales/processed",
defaultLocale: "en",
locales: loadLocales(),
detectBrowserLanguage: false,
compilation: {
jit: false,
strictMessage: false,
},
bundle: {
Expand Down
5 changes: 2 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@
"universal-cookie": "7.2.2",
"vue-advanced-cropper": "2.8.9",
"vue-chartjs": "5.3.2",
"vue-i18n": "9.14.0",
"vue3-popper": "1.5.0",
"vuedraggable": "4.1.0"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "4.4.1",
"@iconify-json/mdi": "1.2.1",
"@nuxt/eslint": "0.7.1",
"@nuxtjs/i18n": "8.5.5",
"@nuxtjs/i18n": "9.1.0",
"@nuxtjs/turnstile": "0.9.11",
"@sentry/bun": "8.40.0",
"@sentry/nuxt": "8.40.0",
Expand Down Expand Up @@ -98,5 +97,5 @@
"unplugin-vue-components": "0.27.4",
"vue-tsc": "2.1.10"
},
"packageManager": "pnpm@9.12.3+sha256.24235772cc4ac82a62627cd47f834c72667a2ce87799a846ec4e8e555e2d4b8b"
"packageManager": "pnpm@9.14.2+sha256.06e65a4965baff6d6097f9c8f75c35f6d420974dbc03d775009056a69edfd271"
}
232 changes: 128 additions & 104 deletions frontend/pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion frontend/src/error.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import type { NuxtError } from "nuxt/app";
import type { HangarNuxtError } from "~/types/components/error";
import type { Composer } from "vue-i18n";
const props = defineProps<{
error: NuxtError<HangarNuxtError>;
Expand Down Expand Up @@ -28,7 +29,7 @@ if (!(props.error?.data?.dummyError === true)) {
}
// custom
let i18n: ReturnType<typeof useI18n>;
let i18n: Composer;
try {
i18n = useI18n();
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/auth/settings/other.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const accentColors = [
const accentColor = useAccentColor();
const locale = ref(i18n.locale);
const languages = (useRuntimeConfig().public.i18n.configLocales as { code: string; name: string }[]).map((locale) => ({
const languages = (useRuntimeConfig().public.i18n.locales as { code: string; name: string }[]).map((locale) => ({
value: locale.code,
text: locale.name,
}));
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export const useSettingsStore = defineStore("settings", () => {

async function loadSettingsServer(event: H3Event) {
if (!import.meta.env.SSR) return;
let newLocale: string;
let newLocale: typeof i18n.locale.value;
let newDarkMode: boolean;
if (authStore.user) {
newLocale = authStore.user.language || "en";
newLocale = (authStore.user.language || "en") as typeof i18n.locale.value;
newDarkMode = (authStore.user.theme || "light") === "dark";
settingsLog("user is logged in, locale = " + newLocale + ", darkMode = " + darkMode.value);
} else {
Expand Down Expand Up @@ -107,7 +107,7 @@ export const useSettingsStore = defineStore("settings", () => {
settingsLog("user is not logged in, using media query, darkmode = " + darkMode.value);
}

let newLocale = authStore.user?.language;
let newLocale = authStore.user?.language as typeof i18n.locale.value;
if (newLocale) {
settingsLog("user is logged in, language = " + newLocale);
} else {
Expand Down

0 comments on commit ae36f75

Please sign in to comment.