AdonisJS v6 is here. Learn more in our release blog post.

View helpers

Following is the list of helper properties and methods shared with the templates.

i18n

An instance of i18n for the default locale is shared with the templates as a global property.

However, the DetectUserLocale middleware overrides this property and shares a request specific instance for the current user's locale.

{{ i18n.locale }}
{{ i18n.formatNumber(100) }}

t

The t helper is an alias for the i18n.formatMessage method.

{{ t('messages.title') }}

getDefaultLocale

Returns the default locale for the application.

{{ getDefaultLocale() }}

getSupportedLocales

Returns an array of the supported locales.

{{ getSupportedLocales() }}