Enhance i18n support and PWA configuration

- Increased the maximum file size for caching in PWA settings from 5MB to 15MB in vite.config.ts.
- Updated import paths for i18n messages in main.ts for consistency.
- Simplified the i18n index by removing unnecessary keys and using shorthand for language imports.
- Added debug output in LoginPage.vue to log current locale and available messages for easier troubleshooting.
This commit is contained in:
mohamad 2025-06-02 18:06:21 +02:00
parent fc49e830fc
commit d623c4b27c
4 changed files with 20 additions and 12 deletions

View File

@ -1,11 +1,11 @@
import en from './en.json'; // Changed from enUS and path
import en from './en.json';
import de from './de.json';
import fr from './fr.json';
import es from './es.json';
export default {
'en': en, // Changed from 'en-US': enUS
'de': de,
'fr': fr,
'es': es
en,
de,
fr,
es
};

View File

@ -5,7 +5,7 @@ import { BrowserTracing } from '@sentry/tracing';
import App from './App.vue';
import router from './router';
import { createI18n } from 'vue-i18n';
import messages from '@/i18n';
import messages from './i18n';
// Global styles
import './assets/main.scss';
@ -26,10 +26,10 @@ import { useAuthStore } from '@/stores/auth';
// // export interface DefineNumberFormat {}
// // }
const i18n = createI18n({
legacy: false, // Recommended for Vue 3
locale: 'en', // Default locale
fallbackLocale: 'en', // Fallback locale
messages,
legacy: false, // Recommended for Vue 3
locale: 'en', // Default locale
fallbackLocale: 'en', // Fallback locale
messages,
});
const app = createApp(App);

View File

@ -57,8 +57,16 @@ const router = useRouter();
const route = useRoute();
const authStore = useAuthStore();
const notificationStore = useNotificationStore();
const { t, locale, messages } = useI18n();
const { t } = useI18n();
// Debug output
console.log('=== i18n Debug Info ===');
console.log('Current locale:', locale.value);
console.log('Available messages:', messages.value);
console.log('English messages:', messages.value.en);
console.log('LoginPage messages:', messages.value.en?.loginPage);
console.log('Test translation:', t('loginPage.emailLabel'));
console.log('Test fallback:', t('message.hello'));
const email = ref('');
const password = ref('');

View File

@ -44,7 +44,7 @@ const pwaOptions: Partial<VitePWAOptions> = {
'dev-sw.js',
'index.html',
],
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024, // 5MB
},
workbox: {
cleanupOutdatedCaches: true,