From 9b2f2c4e910fd99a9d0534f20bda7040da2e96a7 Mon Sep 17 00:00:00 2001 From: igor Date: Sat, 14 Feb 2026 07:34:04 +0100 Subject: [PATCH] added transalations for UI texts --- AGENTS.md | 33 +++++-- doc/prompt.txt | 6 ++ .../components/ingredients/IngredientForm.vue | 29 +++--- .../src/components/meals/MealItemsEditor.vue | 19 ++-- .../src/components/meals/MealTypeFilter.vue | 13 ++- .../components/navigation/AppBottomTabs.vue | 19 ++-- .../src/components/navigation/AppSidebar.vue | 23 +++-- .../src/components/navigation/AppTopbar.vue | 16 +-- frontend/src/components/today/DayMealCard.vue | 12 ++- .../src/components/today/DayTotalsCard.vue | 13 ++- .../src/components/today/MealPickerModal.vue | 10 +- frontend/src/locales/cs.json | 97 +++++++++++++++++++ frontend/src/locales/de.json | 97 +++++++++++++++++++ frontend/src/locales/en.json | 97 +++++++++++++++++++ frontend/src/locales/es.json | 97 +++++++++++++++++++ frontend/src/locales/sk.json | 97 +++++++++++++++++++ frontend/src/types/domain.ts | 6 -- frontend/src/views/IngredientsView.vue | 18 ++-- frontend/src/views/MealDetailView.vue | 20 ++-- frontend/src/views/MealsView.vue | 21 ++-- frontend/src/views/SettingsView.vue | 10 +- frontend/src/views/StatsView.vue | 12 ++- frontend/src/views/TodayView.vue | 12 ++- frontend/vite.config.ts | 22 +++-- 24 files changed, 681 insertions(+), 118 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 367c9fe..6b59c5a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,27 +15,39 @@ It describes what the project is, what is already implemented, and what still ne - `backend/` - `frontend/` -## Current State (as of 2026-02-13) +## Current State (as of 2026-02-14) - `README.md` already contains product specification in Slovak and English. - Backend DB migrations exist in `backend/src/Maintenance.php` up to version `7`. - Backend API methods are implemented in `backend/src/API.php`. -- Frontend auth page is now implemented: +- Frontend auth page is implemented: - `frontend/src/App.vue` renders router view. - - `frontend/src/router/index.ts` maps `/` to `frontend/src/views/AuthView.vue`. + - `frontend/src/router/index.ts` maps `/` to `frontend/src/views/AuthView.vue` for guests. - `AuthView` serves as login + registration entry (single form, email + password). - - Successful login stores `token` and `user_email` in `localStorage`. + - Login now uses `frontend/src/stores/auth.ts` (`Pinia`) and redirects to authenticated app routes. - `frontend/src/views/AuthView.vue` formatting now uses tab-based indentation. - - Login response parsing in `AuthView` now reads user fields from `response.data.user`. -- Frontend i18n is wired: +- Frontend authenticated area is implemented: + - `frontend/src/views/AppLayout.vue` is shell layout. + - Desktop navigation: `frontend/src/components/navigation/AppSidebar.vue`. + - Mobile navigation: `frontend/src/components/navigation/AppBottomTabs.vue`. + - Top bar/title: `frontend/src/components/navigation/AppTopbar.vue`. + - Pages: `TodayView`, `MealsView`, `MealDetailView`, `IngredientsView`, `StatsView`, `SettingsView`. + - Route guard is active for `/app/*` (requires token), guest-only for `/`. +- Frontend i18n is wired and used across new UI: - setup in `frontend/src/i18n/index.ts` - - locale files in `frontend/src/locales/{sk,cs,en,es,de}.ts` + - locale files in `frontend/src/locales/{sk,cs,en,es,de}.json` - language switcher updates locale dynamically. + - new app UI keys are added (`nav`, `pageTitles`, `mealTypes`, `common`, `nutrition`, `today`, `meals`, `ingredients`, `stats`, `settings`). - Frontend theme system is implemented: - light/dark mode toggle in auth page - design tokens in `frontend/src/assets/css/style.css` (`:root` variables). - App logo is served from `frontend/public/Nutrio.png` (copied from `doc/Nutrio.png`). - Font Awesome is installed and registered globally in `frontend/src/main.ts`. +- Pinia is installed and configured in `frontend/src/main.ts` via `frontend/src/stores/index.ts`. +- Frontend domain/store structure exists: + - `frontend/src/types/domain.ts` + - `frontend/src/stores/{auth,ingredients,meals,diary}.ts` + - `frontend/src/utils/{nutrition,api,date}.ts` - `frontend/src/BackendAPI.ts` is generated via `backend/scripts/buildTypeScript.php` and should not be edited manually. - `backend/data.json` contains sample meal data (not currently wired into DB/API flow). @@ -143,7 +155,7 @@ All actions are invoked through `backend/public/API.php` with `?action= -import { reactive, watch } from 'vue' +import { computed, reactive, watch } from 'vue' +import { useI18n } from 'vue-i18n' import type { Ingredient } from '@/types/domain' const props = defineProps<{ @@ -20,6 +21,12 @@ const emit = defineEmits<{ (event: 'cancel'): void }>() +const { t } = useI18n() + +const formTitle = computed(() => { + return props.initial ? t('ingredients.editTitle') : t('ingredients.newTitle') +}) + const form = reactive({ name: '', protein_g_100: 0, @@ -57,40 +64,40 @@ const onSubmit = () => { diff --git a/frontend/src/components/meals/MealItemsEditor.vue b/frontend/src/components/meals/MealItemsEditor.vue index 495278b..084836c 100644 --- a/frontend/src/components/meals/MealItemsEditor.vue +++ b/frontend/src/components/meals/MealItemsEditor.vue @@ -1,5 +1,6 @@  diff --git a/frontend/src/components/navigation/AppBottomTabs.vue b/frontend/src/components/navigation/AppBottomTabs.vue index a218d41..932db36 100644 --- a/frontend/src/components/navigation/AppBottomTabs.vue +++ b/frontend/src/components/navigation/AppBottomTabs.vue @@ -1,11 +1,16 @@