apploud/nette-doctrine-translatable

Extension for Nette framework that simplifies translating of Doctrine entities.

v0.5.0 2020-06-04 10:11 UTC

This package is auto-updated.

Last update: 2024-04-07 21:39:41 UTC


README

Translatable behaviour extension for Doctrine2 as Nette extension

Build Status

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:

  1. locale value
  2. value from locale resolver
  3. default locale

Usage

See documentation of doctrine-translatable