Skip to content

Commit

Permalink
Move /locales to /src/locales.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elweyn committed Mar 26, 2024
1 parent 67eebde commit 805d515
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 10 deletions.
2 changes: 0 additions & 2 deletions presenter/locales/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion presenter/renderer/+onBeforeRoute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContext } from 'vike/types'

import { extractLocale } from '#root/locales/extractLocale'
import { extractLocale } from '#src/locales/extractLocale'

export function onBeforeRoute(pageContext: PageContext) {
const { urlWithoutLocale, locale } = extractLocale(pageContext.urlPathname)

Check failure on line 6 in presenter/renderer/+onBeforeRoute.ts

View workflow job for this annotation

GitHub Actions / Lint - Presenter

Unsafe array destructuring of a tuple element with an `any` value
Expand Down
2 changes: 1 addition & 1 deletion presenter/renderer/+onPrerenderStart.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageContextServer } from 'vike/types'

import { locales, localeDefault } from '#root/locales'
import { locales } from '#src/locales'

export { onPrerenderStart }

Expand Down
2 changes: 1 addition & 1 deletion presenter/renderer/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createApolloClient } from '#plugins/apollo'
import i18n from '#plugins/i18n'
import pinia from '#plugins/pinia'
import CreateVuetify from '#plugins/vuetify'
import { locales } from '#root/locales'
import { locales } from '#src/locales'
import AuthService from '#src/services/AuthService'
import { useAuthStore } from '#stores/authStore'

Expand Down
5 changes: 3 additions & 2 deletions presenter/renderer/plugins/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createI18n } from 'vue-i18n'
import { de as vuetifyDe, en as vuetifyEn } from 'vuetify/locale'

import { localeDefault, fallbackLocale } from '#src/locales'
import de from '#src/locales/de.json'
import en from '#src/locales/en.json'

export default createI18n({
legacy: false, // Vuetify does not support the legacy mode of vue-i18n
globalInjection: true,
locale: 'de',
fallbackLocale: 'en',
locale: localeDefault,
fallbackLocale,
messages: {
de: {
$vuetify: vuetifyDe,
Expand Down
3 changes: 2 additions & 1 deletion presenter/src/components/language/LanguageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { localizedLocale } from '#root/locales'
import { localizedLocale } from '#src/locales'
const languages = ref(localizedLocale)
</script>
Expand Down Expand Up @@ -93,3 +93,4 @@ const languages = ref(localizedLocale)
}
}
</style>
#src/locales

Check failure on line 96 in presenter/src/components/language/LanguageSelector.vue

View workflow job for this annotation

GitHub Actions / Lint - Presenter

Insert `⏎`
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export { extractLocale } from './extractLocale'
export type LocaleCode = 'de' | 'en'
export const locales: LocaleCode[] = ['de', 'en']
export const localeDefault = 'de'
export const fallbackLocale = 'en'
export const localizedLocale = [
{ locale: 'de', title: 'Deutsch' },
{ locale: 'en', title: 'English' },
Expand Down
2 changes: 1 addition & 1 deletion presenter/types/PageContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LocaleCode } from '#root/locales/locales'
import { LocaleCode } from '#src/locales'
import { Page } from '#types/Page'
import { PageProps } from '#types/PageProps'

Expand Down
2 changes: 1 addition & 1 deletion presenter/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: UserConfig = {
!isStorybook() && vike({ prerender: true }), // SSR only when storybook is not running
vueI18n({
ssr: true,
include: path.resolve(__dirname, './src/locales/**'),
include: path.resolve(__dirname, './src/locales/**.json'),
jitCompilation: false,
}),
checker({
Expand Down

0 comments on commit 805d515

Please sign in to comment.