Translations
Provide multilingual support for your plugin's user interface.
Translation Files
Create translation files in Resources/translations/ or translations/:
plugins/my-plugin/
└── Resources/
└── translations/
├── messages.en.yaml
├── messages.pl.yaml
└── messages.de.yamlTranslation Domain
Use plugin_{plugin_name} as the translation domain (snake_case!):
plugin_my_pluginplugin_hello_worldplugin_paypal_payment
English Translations (messages.en.yaml)
Polish Translations (messages.pl.yaml)
Using Translations in Templates
Using Translations in PHP
Parameterized Translations
Pluralization
Translation Keys Organization
Organize keys by component/section:
Language Detection
PteroCA automatically detects user language based on:
User's selected language (from profile)
Browser's Accept-Language header
System default language
Translation Best Practices
Use clear key structure - organize by section/component
Provide all translations - at minimum English
Use parameters for dynamic content
Keep translations short - especially for buttons/labels
Test with different languages - ensure UI layout works
Document translation keys - for other translators
Use consistent terminology - same words for same concepts
Avoid hardcoded text - always use translation keys
Translation File Locations
Two locations are supported:
Option 1: Resources/translations/
Option 2: translations/
Choose one location and be consistent.
Translation Testing
Test translations by changing language:
Related Guides
UI Components - Translate widgets and tabs
Controllers & Routes - Flash messages
CRUD Controllers - Admin interface translations
Last updated