In addition to the trait we also provide a helper class
\Astrotomic\Translatable\Locales it's a singleton service available as
This helper manages all locales available for translation and provides several methods.
This class also implements the
ArrayAccess interface to allow you to use it like a normal array.
This method will (re)load all locales from the
translatable.locales config - it's called during service instantiation so you will only need it if you change the config during runtime.
Returns all available locales as an array - the structure differs from the config one, the return final generated array with combined country locales.
Returns the current locale string.
Checks if the given locale is available in the configured set of locales.
Returns the provided locale or
null if it's not set.
Adds the given locale to the set of available locales.
Removes the given locale of the available locales set.
Returns the configured
translatable.locale_separator locale separator used to combine language with country locales.
Returns the formatted country based locale.
Checks if the given locale is a country specific locale.
Returns the language locale from given country based locale.