Files
summer-phrasebook/docs/research/wintercms/quotifypro-16-i18n-content-localization/16-01-PLAN.md
2026-02-18 01:31:41 +01:00

5.7 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
phase plan type wave depends_on files_modified autonomous must_haves
16-content-localization 01 execute 1
plugins/golem15/quotify/models/TradeCategory.php
plugins/golem15/quotify/updates/version.yaml
plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php
true
truths artifacts key_links
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
path provides contains
plugins/golem15/quotify/models/TradeCategory.php TranslatableModel behavior for category translations TranslatableModel
path provides
plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php Polish and German translations for all 33 categories
from to via pattern
TradeCategory.php Golem15.Translate plugin $implement array 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

<execution_context> @/home/jin/.claude/get-shit-done/workflows/execute-plan.md @/home/jin/.claude/get-shit-done/templates/summary.md </execution_context>

@.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):

    public $implement = ['@Golem15.Translate.Behaviors.TranslatableModel'];
    
  2. Add $translatable property listing fields to translate:

    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").

  1. Update version.yaml to add:
    - 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:

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

<success_criteria>

  • 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 </success_criteria>
After completion, create `.planning/phases/16-content-localization/16-01-SUMMARY.md`