Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

4.4.0

Compare
Choose a tag to compare
@lcharette lcharette released this 18 Mar 01:03
· 23 commits to master since this release
9f2e255

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 now Translator.
  • Translator requires a DictionaryInterface as some constructor argument instead of paths.
  • LocalePathBuilder removed.
  • DictionaryInterface now extends UserFrosting\Support\Repository\Repository instead of the Translator. 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.