LocalizationService

This service class contains functions related to localization functionality.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Methods
public getLocalizationData():array

Get localization data for the frontend. This data contains active shipping countries, active languages, the current shipping country and the shop language.

public setLanguage($newLanguage, $fireEvent = true)

Set a new language

Parameters

Type

Name

Description

string

$newLanguage

The new language (ISO-639-1)

bool

$fireEvent

Optional: Fire a LanguageChanged event (Default: false)

public getTranslations($plugin, $group, $lang = null):mixed

Get translations for a plugin. This function is primarily used in the frontend to enable clientside translation.

Parameters

Type

Name

Description

string

$plugin

The plugin, whose translation is to be fetched. E.g "Ceres" in "Ceres::Widgets.exampleTranslation"

string

$group

The translation group, which is to be fetched. E.g "Widgets" in "Ceres::Widgets.exampleTranslation"

string

$lang

Optional: The language for the translations. By default uses the current active language.

public hasCountryStates($countryId):bool

Check if a specific country has states

Parameters

Type

Name

Description

int

$countryId

An countries id