Sets the central locale-string.

This setting is propagated into the locale-string-setting, internally and into the ENV.

This string is used as primary and fallback setting for translations and localized renderings such as numbers, dates, etc..


Syntax

setLocale(?string $locale): bool

  • $locale - string|null
    A locale string, e.g. "de_DE", "en-US".
    NULL unsets the locale-string and indirectly disables probably some fallback translations/localization renderings in dependent components.


Example

Setting the locale for the rendering.

{% do hublify.setLocale('de-DE') %}