apploud / nette-doctrine-translatable
Extension for Nette framework that simplifies translating of Doctrine entities.
v0.5.0
2020-06-04 10:11 UTC
Requires
- php: >=7.1
- doctrine/orm: *
- nette/di: ^3.0
- prezent/doctrine-translatable: ^2.0
Requires (Dev)
- nette/bootstrap: ^3.0
- nette/tester: ^1.7
This package is auto-updated.
Last update: 2025-01-07 23:22:39 UTC
README
Translatable behaviour extension for Doctrine2 as Nette extension
Installation
The best way to install TranslationsConverter is using Composer:
$ composer require apploud/nette-doctrine-translatable
You can enable the extension using your neon config.
extensions: translatable: Apploud\Doctrine\Translatable\DI\TranslatableExtension
You also need to have an instance of Doctrine\ORM\EntityManager
defined as a service with autowiring turned on (or pass it in configuration).
Configuration
Configuration example with all possible settings:
translatable: entityManager: @doctrine.entityManager defaultLocale: defaultLocale currentLocale: currentLocale fallbackLocale: fallbackLocale currentLocaleResolver: [@resolverService, 'getCurrentLocale'] fallbackLocaleResolver: [@resolverService, 'getFallbackLocale']
All settings are optional. If entityManager
is missing, it will be autowired. Any other value defaults to NULL
. Locale resolver can be any callable
.
When determining current and fallback locales, priorities are:
- locale value
- value from locale resolver
- default locale