4.4.0
Complete rewrite of the Translator.
Instead of LocalePathBuilder -> MessageTranslator
, the new translator introduce the concept of Locale
, Dictionary
and Translator
. So now you create a locale, which enables you to create a dictionary for that locale, which finally allows you to create a translator which will used that dictionary.
Instead of loading multiple locale on top of each other, a locale can depend on other locale using the configuration file (ie. locale.yaml
). See the updated doc for more information.
Plural rule are now defined in the locale configuration file instead of the special @PLURAL_RULE
key.
All methods of the Translator
are the same for backward compatibility. The only change is the constructor, which now requires a DictionaryInterface
instance.
Detailed changes :
MessageTranslator
is nowTranslator
.Translator
requires aDictionaryInterface
as some constructor argument instead of paths.LocalePathBuilder
removed.DictionaryInterface
now extendsUserFrosting\Support\Repository\Repository
instead of theTranslator
. The raw data can be accessed using the Dictionary methods.@PLURAL_RULE
special key removed. Use the Locale configuration file (locale.yaml
)plural_rule
attribute instead.- Translator can't load multiple locale anymore. Use the Locale configuration file
parents
attribute instead.
See updated documentation for more details on how to use the new Translator, Locale and Dictionary.