114 lines
3.9 KiB
Markdown
114 lines
3.9 KiB
Markdown
---
|
|
phase: 16-content-localization
|
|
plan: 01
|
|
subsystem: translation
|
|
tags: [i18n, trade-categories, polish, german, TranslatableModel]
|
|
depends_on:
|
|
requires: [11-01, 15-01]
|
|
provides: [translatable-trade-categories, pl-de-category-translations]
|
|
affects: [16-02, job-posting, professional-profiles, search]
|
|
tech-stack:
|
|
added: []
|
|
patterns: [TranslatableModel-behavior, DB-seeder-pattern]
|
|
key-files:
|
|
created:
|
|
- plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php
|
|
modified:
|
|
- plugins/golem15/quotify/models/TradeCategory.php
|
|
- plugins/golem15/quotify/updates/version.yaml
|
|
decisions:
|
|
- "Use soft dependency (@) for TranslatableModel behavior"
|
|
- "36 categories translated (9 main + 27 sub), not 33 as originally estimated"
|
|
- "DB::table() pattern for seeder to avoid model boot issues"
|
|
metrics:
|
|
duration: 3 min
|
|
completed: 2026-02-02
|
|
---
|
|
|
|
# Phase 16 Plan 01: Trade Category Translations Summary
|
|
|
|
TranslatableModel behavior added to TradeCategory with Polish and German translations seeded for all 36 categories.
|
|
|
|
## What Was Done
|
|
|
|
### Task 1: Add TranslatableModel behavior to TradeCategory
|
|
Added the Golem15.Translate.Behaviors.TranslatableModel behavior to the TradeCategory model with soft dependency prefix (@). Marked `name` and `description` as translatable fields.
|
|
|
|
**Key changes:**
|
|
- Added `$implement` array with TranslatableModel behavior
|
|
- Added `$translatable = ['name', 'description']` property
|
|
|
|
### Task 2: Seed Polish and German translations
|
|
Created migration v1.4.0/add_trade_category_translations.php that seeds translations for all trade categories.
|
|
|
|
**Categories translated (36 total):**
|
|
|
|
| Main Category | Polish | German |
|
|
|---------------|--------|--------|
|
|
| Plumbing | Hydraulika | Sanitaer- und Heizungstechnik |
|
|
| Electrical | Elektryka | Elektrik |
|
|
| Painting & Decorating | Malowanie i dekoracja | Malerarbeiten |
|
|
| Carpentry | Stolarstwo | Tischlerei |
|
|
| Roofing | Dekarstwo | Dachdeckerei |
|
|
| Masonry | Murarstwo | Maurerarbeiten |
|
|
| HVAC | Klimatyzacja i wentylacja | Heizung, Lueftung, Klimatechnik |
|
|
| Landscaping | Architektura krajobrazu | Garten- und Landschaftsbau |
|
|
| General Repairs | Naprawy ogolne | Allgemeine Reparaturen |
|
|
|
|
Plus 27 subcategories with appropriate translations.
|
|
|
|
## Decisions Made
|
|
|
|
1. **Soft dependency for TranslatableModel**: Using `@` prefix allows TradeCategory to work even if Translate plugin is not installed.
|
|
|
|
2. **36 categories, not 33**: Actual database has 9 main categories with 3 subcategories each = 36 total (not 33 as estimated in plan).
|
|
|
|
3. **DB::table() pattern**: Consistent with project decision 11-01, using raw DB queries in seeder to avoid model boot issues during migration.
|
|
|
|
## Verification Results
|
|
|
|
```php
|
|
// Polish translation
|
|
$translator->setLocale('pl');
|
|
$cat = TradeCategory::where('slug', 'plumbing')->first();
|
|
$cat->name; // "Hydraulika"
|
|
|
|
// German translation
|
|
$translator->setLocale('de');
|
|
$cat->name; // "Sanitaer- und Heizungstechnik"
|
|
|
|
// English (default)
|
|
$translator->setLocale('en');
|
|
$cat->name; // "Plumbing"
|
|
```
|
|
|
|
## Deviations from Plan
|
|
|
|
None - plan executed exactly as written.
|
|
|
|
## Commits
|
|
|
|
| Hash | Message |
|
|
|------|---------|
|
|
| b9765b4 | feat(16-01): add TranslatableModel behavior to TradeCategory |
|
|
| 1d65bed | feat(16-01): seed Polish and German translations for trade categories |
|
|
| 9984eae | chore(16-01): update quotify submodule for trade category translations |
|
|
|
|
## Files Changed
|
|
|
|
**Created:**
|
|
- `plugins/golem15/quotify/updates/v1.4.0/add_trade_category_translations.php`
|
|
|
|
**Modified:**
|
|
- `plugins/golem15/quotify/models/TradeCategory.php`
|
|
- `plugins/golem15/quotify/updates/version.yaml`
|
|
|
|
## Next Phase Readiness
|
|
|
|
Phase 16-01 complete. Ready for 16-02 (Service Area translations) or other content localization tasks.
|
|
|
|
**Prerequisites delivered:**
|
|
- TradeCategory model is translatable
|
|
- Polish and German translations seeded
|
|
- Pattern established for other models needing translation
|