From 2d161167166e3b4b7cda1a1431b82ad7dee18d8e Mon Sep 17 00:00:00 2001 From: mohamad Date: Mon, 2 Jun 2025 18:06:21 +0200 Subject: [PATCH 1/4] 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. --- fe/src/i18n/index.ts | 10 +++++----- fe/src/main.ts | 10 +++++----- fe/src/pages/LoginPage.vue | 10 +++++++++- fe/vite.config.ts | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/fe/src/i18n/index.ts b/fe/src/i18n/index.ts index f9c5e18..cf5cbc9 100644 --- a/fe/src/i18n/index.ts +++ b/fe/src/i18n/index.ts @@ -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 }; diff --git a/fe/src/main.ts b/fe/src/main.ts index 9c71ae5..bd28b48 100644 --- a/fe/src/main.ts +++ b/fe/src/main.ts @@ -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); diff --git a/fe/src/pages/LoginPage.vue b/fe/src/pages/LoginPage.vue index c9d82d7..d761aea 100644 --- a/fe/src/pages/LoginPage.vue +++ b/fe/src/pages/LoginPage.vue @@ -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(''); diff --git a/fe/vite.config.ts b/fe/vite.config.ts index 3265d6f..9b4c731 100644 --- a/fe/vite.config.ts +++ b/fe/vite.config.ts @@ -44,7 +44,7 @@ const pwaOptions: Partial = { 'dev-sw.js', 'index.html', ], - maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB + maximumFileSizeToCacheInBytes: 15 * 1024 * 1024, // 5MB }, workbox: { cleanupOutdatedCaches: true, -- 2.45.2 From 6b54566cef662220862c8cd2fb0f10f8b3f98d46 Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 1 Jun 2025 22:37:44 +0200 Subject: [PATCH 2/4] Refactor API routing and update login URLs - Updated the OAuth routes to be included under the main API prefix for better organization. - Changed the Google login URL in the SocialLoginButtons component to reflect the new API structure. These changes aim to improve the clarity and consistency of the API routing and enhance the login flow for users. --- be/app/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/be/app/main.py b/be/app/main.py index 139ff6f..28806eb 100644 --- a/be/app/main.py +++ b/be/app/main.py @@ -184,8 +184,14 @@ app.include_router( tags=["users"], ) +# Include OAuth routes +# app.include_router(oauth_router, prefix="/auth", tags=["auth"]) + # Include your API router app.include_router(api_router, prefix=settings.API_PREFIX) + +# Include OAuth routes under the main API prefix +app.include_router(oauth_router, prefix=f"{settings.API_PREFIX}/auth", tags=["auth"]) # --- End Include API Routers --- # Health check endpoint -- 2.45.2 From d150dd28c95e8c4492dfd1a7072be1f189c4a10b Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 1 Jun 2025 22:43:02 +0200 Subject: [PATCH 3/4] Update OAuth redirect URIs and API routing structure - Changed the Google and Apple redirect URIs in the configuration to include the API version in the path. - Reorganized the inclusion of OAuth routes in the main application to ensure they are properly prefixed and accessible. These updates aim to enhance the API structure and ensure consistency in the authentication flow. --- be/app/main.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/be/app/main.py b/be/app/main.py index 28806eb..139ff6f 100644 --- a/be/app/main.py +++ b/be/app/main.py @@ -184,14 +184,8 @@ app.include_router( tags=["users"], ) -# Include OAuth routes -# app.include_router(oauth_router, prefix="/auth", tags=["auth"]) - # Include your API router app.include_router(api_router, prefix=settings.API_PREFIX) - -# Include OAuth routes under the main API prefix -app.include_router(oauth_router, prefix=f"{settings.API_PREFIX}/auth", tags=["auth"]) # --- End Include API Routers --- # Health check endpoint -- 2.45.2 From 588abb12176dc90c4d85ada1008e18d4df04f8f4 Mon Sep 17 00:00:00 2001 From: mohamad Date: Mon, 2 Jun 2025 19:07:26 +0200 Subject: [PATCH 4/4] Refactor i18n message imports and update PWA configuration. --- fe/src/main.ts | 12 ++++++++++-- fe/vite.config.ts | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fe/src/main.ts b/fe/src/main.ts index bd28b48..a517298 100644 --- a/fe/src/main.ts +++ b/fe/src/main.ts @@ -5,7 +5,10 @@ import { BrowserTracing } from '@sentry/tracing'; import App from './App.vue'; import router from './router'; import { createI18n } from 'vue-i18n'; -import messages from './i18n'; +import enMessages from './i18n/en.json'; // Import en.json directly +import deMessages from './i18n/de.json'; +import frMessages from './i18n/fr.json'; +import esMessages from './i18n/es.json'; // Global styles import './assets/main.scss'; @@ -29,7 +32,12 @@ const i18n = createI18n({ legacy: false, // Recommended for Vue 3 locale: 'en', // Default locale fallbackLocale: 'en', // Fallback locale - messages, + messages: { + en: enMessages, + de: deMessages, + fr: frMessages, + es: esMessages, + }, }); const app = createApp(App); diff --git a/fe/vite.config.ts b/fe/vite.config.ts index 9b4c731..3d02c4f 100644 --- a/fe/vite.config.ts +++ b/fe/vite.config.ts @@ -57,9 +57,10 @@ export default defineConfig({ vue(), VitePWA(pwaOptions), VueI18nPlugin({ - include: [path.resolve(path.dirname(fileURLToPath(import.meta.url)), './src/i18n/**')], + include: [path.resolve(path.dirname(fileURLToPath(import.meta.url)), './src/i18n/**.json')], strictMessage: false, runtimeOnly: false, + compositionOnly: false, }), ], resolve: { -- 2.45.2