Reintroduce custom translation containers
crbelaus opened this issue · 1 comments
crbelaus commented
With PR #31 Trans lost de capability of using a custom translation container and instead was always trying to use the field named translations
to store and look for the translations.
While having the translations in a field named translations
will be the most common case, there may also exist certain cases in which translations must be stored in a different field. This issue proposes the following changes to gain this functionality back:
- Allow users to specify the desired translation container when using
Trans
in their modules. If ommited the translation container field name will default totranslations
. - Generate a
__trans__(:container)
function which returns the name of the translation container for a given module. - Update
Trans.Translator.translate
andTrans.Translator.QueryBuilder
to use this function for retrieving the name of the translator container field.