Skip to content

getLocale(int locale_id, bool use_localized_names)

The getLocale method is used to get a Locale object that represents locale in the storefront.

Input parameters

locale_id

int Numeric identifier of the locale.

use_localized_names

bool Should country names be localized? Parameter is optional. Default: false.

Returned value

The Locale object. If the locale is inactive or does not exist, the method returns null.

Example

source
{% set locale = ObjectApi.getLocale(locale_id) %}
{{ locale.name }}
output
english