Download the PHP package tobento/app-translation without Composer
On this page you can find all versions of the php package tobento/app-translation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tobento/app-translation
More information about tobento/app-translation
Files in tobento/app-translation
Package app-translation
Short Description App translation support.
License MIT
Homepage https://www.tobento.ch
Informations about the package app-translation
App Translation
Translation support for the app.
Table of Contents
- Getting Started
- Requirements
- Documentation
- App
- Translation Boot
- Translate Message
- Configure Translator
- Migrate Translations
- Add Translations
- Customize Translations
- Credits
Getting Started
Add the latest version of the app translation project running this command.
Requirements
- PHP 8.0 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Translation Boot
The translation boot does the following:
- implements TranslatorInterface
- adds app macro
By default, Files Resources are used for the translator.
Translate Message
You can translate messages in several ways:
Using the app
Using autowiring
You can also request the in any class resolved by the app.
Using the translation boot
Check out the Translation Service to learn more about it.
Using the trans function
Configure Translator
Configure locale using the app language
First install the app-language bundle:
Then, just boot the . That's all. The locales will be set based on the .
Configure locale manually
Configure missing translations
If you may want to log missing translation, you can set the implementation to fit your needs.
Migrate Translations
By default, Files Resources are used for the translator. Therefore, you might install and use the App Migration bundle:
Writing a migration
Migration Boot
App example
Add Translations
You can simply add more translations by the following way:
You may check out the Add Resources section to learn more about it.
Customize Translations
You might customize/override translations by the following ways:
By adding a resource with higher priority
You may specify only the translations you want to overrride as same named resources get merged.
You may check out the Add Resources section to learn more about it.
By adding a new trans dir with higher priority
Then just add the translation files you wish to override in the defined directory. If the file does not exist, the file from the default trans directory is used.
Using the translation manager
In progress...
Credits
- Tobias Strub
- All Contributors