--- phase: 16-content-localization plan: 01 type: execute wave: 1 depends_on: [] files_modified: - plugins/golem15/quotify/models/TradeCategory.php - plugins/golem15/quotify/updates/version.yaml - plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php autonomous: true must_haves: truths: - "Trade category names display in user's selected locale" - "Trade category descriptions display in user's selected locale" - "English remains default when no translation exists" artifacts: - path: "plugins/golem15/quotify/models/TradeCategory.php" provides: "TranslatableModel behavior for category translations" contains: "TranslatableModel" - path: "plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php" provides: "Polish and German translations for all 33 categories" key_links: - from: "TradeCategory.php" to: "Golem15.Translate plugin" via: "$implement array" pattern: "golem15.translate.Behaviors.TranslatableModel" --- Make trade categories translatable with Polish and German translations for all 33 categories. Purpose: Trade categories appear throughout the marketplace (job posting, professional profiles, search). Users should see them in their language. Output: TradeCategory model with TranslatableModel behavior and seeded translations for PL/DE @/home/jin/.claude/get-shit-done/workflows/execute-plan.md @/home/jin/.claude/get-shit-done/templates/summary.md @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/16-content-localization/16-CONTEXT.md @plugins/golem15/quotify/models/TradeCategory.php @plugins/golem15/translate/behaviors/TranslatableModel.php @plugins/golem15/quotify/updates/v1.0.1/seed_trade_categories.php Task 1: Add TranslatableModel behavior to TradeCategory plugins/golem15/quotify/models/TradeCategory.php Add the TranslatableModel behavior to TradeCategory model: 1. Add to $implement array (use @ prefix for soft dependency): ```php public $implement = ['@Golem15.Translate.Behaviors.TranslatableModel']; ``` 2. Add $translatable property listing fields to translate: ```php public $translatable = ['name', 'description']; ``` These two additions enable the Translate plugin to store and retrieve translations for category names and descriptions. The @ prefix means it works even if Translate plugin isn't installed. Run `php-legacy artisan winter:up` to ensure model loads without error. Check in tinker that TradeCategory::first()->translatable returns ['name', 'description']. TradeCategory model has TranslatableModel behavior with name and description as translatable fields. Task 2: Seed Polish and German translations for all trade categories plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php plugins/golem15/quotify/updates/version.yaml Create migration that seeds translations for all 33 trade categories: 1. Create directory: `updates/v1.4.0/` 2. Create seeder `add_trade_category_translations.php` using DB::table() pattern (avoid model boot issues): - Get all existing TradeCategory records - For each category, insert into `winter_translate_attributes` table with: - locale: 'pl' and 'de' - model_id: category ID - model_type: 'Golem15\Quotify\Models\TradeCategory' - attribute_data: JSON with translated name and description 3. Translation content (9 main + 24 sub = 33 categories): **Main categories Polish:** - Plumbing = Hydraulika - Electrical = Elektryka - Carpentry = Stolarstwo - Painting = Malowanie - Roofing = Dekarstwo - HVAC = Klimatyzacja i wentylacja - Landscaping = Architektura krajobrazu - Masonry = Murarstwo - General Construction = Budownictwo ogolne **Main categories German:** - Plumbing = Sanitaer- und Heizungstechnik - Electrical = Elektrik - Carpentry = Tischlerei - Painting = Malerarbeiten - Roofing = Dachdeckerei - HVAC = Heizung, Lueftung, Klimatechnik - Landscaping = Garten- und Landschaftsbau - Masonry = Maurerarbeiten - General Construction = Allgemeiner Hochbau For subcategories, translate each appropriately (e.g., "Pipe Repair" -> "Naprawa rur" / "Rohreparatur"). 4. Update version.yaml to add: ```yaml - v1.4.0: - 'Add trade category translations' - v1.4.0/add_trade_category_translations.php ``` Use the existing seed file (v1.0.1/seed_trade_categories.php) as reference for the category structure. Run `php-legacy artisan winter:up`. Then in tinker: ```php App::setLocale('pl'); $cat = Golem15\Quotify\Models\TradeCategory::where('slug', 'plumbing')->first(); echo $cat->name; // Should output "Hydraulika" ``` All 33 trade categories have Polish and German translations seeded in database. 1. Trade categories display in Polish when locale is 'pl' 2. Trade categories display in German when locale is 'de' 3. Trade categories display in English when locale is 'en' (original data) 4. Job posting form shows translated category names 5. Professional profile shows translated categories - TradeCategory model implements TranslatableModel behavior - All 33 categories have name translations for PL and DE - All 33 categories have description translations for PL and DE - Switching locale in app shows correct language for categories After completion, create `.planning/phases/16-content-localization/16-01-SUMMARY.md`