WinterCMS research
This commit is contained in:
191
docs/research/wintercms/quotifypro-11-i18n/11-02-PLAN.md
Normal file
191
docs/research/wintercms/quotifypro-11-i18n/11-02-PLAN.md
Normal file
@@ -0,0 +1,191 @@
|
||||
---
|
||||
phase: 11-translation-infrastructure
|
||||
plan: 02
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: ["11-01"]
|
||||
files_modified:
|
||||
- themes/quotify/config/translate.yaml
|
||||
autonomous: true
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "translate:scan extracts theme strings to database"
|
||||
- "Messages backend page shows extracted strings"
|
||||
- "Theme has translate.yaml config for organized translation management"
|
||||
artifacts:
|
||||
- path: "themes/quotify/config/translate.yaml"
|
||||
provides: "Theme translation configuration file"
|
||||
key_links:
|
||||
- from: "translate:scan"
|
||||
to: "winter_translate_messages table"
|
||||
via: "ThemeScanner::scanForMessages()"
|
||||
---
|
||||
|
||||
<objective>
|
||||
Scan theme templates and set up translation workflow.
|
||||
|
||||
Purpose: Extract all translatable strings from the Quotify theme into the database for translation management, and create the theme's translation config file.
|
||||
Output: All theme strings scanned into database, translate.yaml config in place.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/get-shit-done/workflows/execute-plan.md
|
||||
@~/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
|
||||
# Prior plan
|
||||
@.planning/phases/11-translation-infrastructure/11-01-SUMMARY.md
|
||||
|
||||
# Translation scanner
|
||||
@plugins/golem15/translate/classes/ThemeScanner.php
|
||||
@plugins/golem15/translate/console/ScanCommand.php
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Create theme translate.yaml configuration</name>
|
||||
<files>themes/quotify/config/translate.yaml</files>
|
||||
<action>
|
||||
Create the theme's translation configuration file for organized translation management.
|
||||
This file allows defining translations directly in the theme config (alternative to database management).
|
||||
|
||||
Create `themes/quotify/config/translate.yaml`:
|
||||
```yaml
|
||||
# Quotify Theme Translation Configuration
|
||||
# This file can contain static translations or reference YAML files per locale.
|
||||
# The translate:scan command will import these into the database.
|
||||
#
|
||||
# Structure options:
|
||||
# 1. Inline translations:
|
||||
# en:
|
||||
# 'Hello': 'Hello'
|
||||
# pl:
|
||||
# 'Hello': 'Cześć'
|
||||
#
|
||||
# 2. Reference YAML files:
|
||||
# en: en.yaml
|
||||
# pl: pl.yaml
|
||||
#
|
||||
# For now, we rely on database-based translation management via backend.
|
||||
# This file serves as documentation and can be extended later for static translations.
|
||||
|
||||
# Placeholder for future static translations
|
||||
# Translations are managed via Backend > Settings > Translation Messages
|
||||
```
|
||||
|
||||
Note: The translate.yaml file is optional but good practice. The primary workflow uses:
|
||||
1. `translate:scan` to extract strings from theme templates
|
||||
2. Backend Messages interface to add translations
|
||||
3. Export/Import for bulk translation management
|
||||
</action>
|
||||
<verify>File exists at themes/quotify/config/translate.yaml</verify>
|
||||
<done>Theme translation config file created</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Run theme translation scan</name>
|
||||
<files>None (database operation)</files>
|
||||
<action>
|
||||
Run the translation scanner to extract all translatable strings from the theme:
|
||||
|
||||
1. First, run with purge to start fresh:
|
||||
```bash
|
||||
php-legacy artisan translate:scan --purge
|
||||
```
|
||||
This will:
|
||||
- Truncate existing messages (fresh start for Quotify)
|
||||
- Scan all theme layouts, pages, partials
|
||||
- Scan all plugin component templates
|
||||
- Scan all mail templates
|
||||
- Import found strings into winter_translate_messages table
|
||||
|
||||
2. Clear cache after scan:
|
||||
```bash
|
||||
php-legacy artisan cache:clear
|
||||
```
|
||||
|
||||
3. Verify scan results by checking message count:
|
||||
```bash
|
||||
php-legacy artisan tinker --execute="echo \Golem15\Translate\Models\Message::count() . ' messages scanned'"
|
||||
```
|
||||
Expected: Several hundred messages (theme has ~3600+ translation filter usages, but many are duplicates)
|
||||
</action>
|
||||
<verify>Message count is > 100 (theme has substantial content)</verify>
|
||||
<done>Theme strings successfully scanned into database</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Verify translation workflow end-to-end</name>
|
||||
<files>None (verification only)</files>
|
||||
<action>
|
||||
Verify the complete translation workflow is operational:
|
||||
|
||||
1. Check a sample message exists and has correct structure:
|
||||
```bash
|
||||
php-legacy artisan tinker --execute="
|
||||
\$msg = \Golem15\Translate\Models\Message::first();
|
||||
echo 'Code: ' . \$msg->code . PHP_EOL;
|
||||
echo 'Data: ' . json_encode(\$msg->message_data) . PHP_EOL;
|
||||
"
|
||||
```
|
||||
|
||||
2. Check locales are available for selection:
|
||||
```bash
|
||||
php-legacy artisan tinker --execute="
|
||||
print_r(\Golem15\Translate\Models\Locale::listEnabled());
|
||||
"
|
||||
```
|
||||
Expected: ['en' => 'English', 'pl' => 'Polski', 'de' => 'Deutsch']
|
||||
|
||||
3. Verify export columns include all locales:
|
||||
```bash
|
||||
php-legacy artisan tinker --execute="
|
||||
print_r(\Golem15\Translate\Models\MessageExport::getColumns());
|
||||
"
|
||||
```
|
||||
Expected: ['code' => 'code', 'x' => 'default', 'en' => 'en', 'pl' => 'pl', 'de' => 'de']
|
||||
|
||||
4. Test Message::trans() works:
|
||||
```bash
|
||||
php-legacy artisan tinker --execute="
|
||||
\Golem15\Translate\Models\Message::\$locale = 'en';
|
||||
echo \Golem15\Translate\Models\Message::trans('Home');
|
||||
"
|
||||
```
|
||||
Should return 'Home' (or the translated value if exists)
|
||||
</action>
|
||||
<verify>All tinker checks pass without errors</verify>
|
||||
<done>Translation workflow verified end-to-end</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
Before declaring plan complete:
|
||||
- [ ] themes/quotify/config/translate.yaml exists
|
||||
- [ ] translate:scan completed successfully
|
||||
- [ ] Messages table has 100+ entries
|
||||
- [ ] Locale::listEnabled() returns all 3 locales
|
||||
- [ ] MessageExport::getColumns() includes en, pl, de columns
|
||||
- [ ] Message::trans() returns translated content
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
|
||||
- All tasks completed
|
||||
- Theme translation config file created
|
||||
- Theme strings scanned into database
|
||||
- Translation workflow verified working
|
||||
- All locales available for translation
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/11-translation-infrastructure/11-02-SUMMARY.md`
|
||||
</output>
|
||||
Reference in New Issue
Block a user