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 |
|
true |
|
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:-
Add to $implement array (use @ prefix for soft dependency):
public $implement = ['@Golem15.Translate.Behaviors.TranslatableModel']; -
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.
-
Create directory:
updates/v1.4.0/ -
Create seeder
add_trade_category_translations.phpusing DB::table() pattern (avoid model boot issues):- Get all existing TradeCategory records
- For each category, insert into
winter_translate_attributestable with:- locale: 'pl' and 'de'
- model_id: category ID
- model_type: 'Golem15\Quotify\Models\TradeCategory'
- attribute_data: JSON with translated name and description
-
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").
- 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"
<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>