I18n Twig extensions
Functions
1| emsco_i18n_all
Retrieve the list of locales of an I18n entity with an optional json decode for its content. This method has 2 arguments:
- name: Required, string, the name of the I18n entity
- json_decode: Optional, boolean, default(false), specify if the content of the locales should be decoded or not.
Example Where config is the identifier of an I18n entity, which has the following content
php
[
[
'locale' => 'en'
'text' => '{"locales": ["en", "fr", "nl", "de" ]}'
],
[
'locale' => 'fr'
'text' => '{"locales": ["en", "fr", "nl", "de" ]}'
]
]Without json_decode:
php
{{ emsco_i18n_list('config') }}
// will return
{
'en' => '{"locales": ["en", "fr", "nl", "de" ]}',
'fr' => '{"locales": ["en", "fr", "nl", "de" ]}'
}With json_decode:
php
{{ emsco_i18n_list('config', true) }}
// will return
{
'en' => {
'locales' => ["en", "fr", "nl", "de" ]
},
'fr' => {
'locales' => ["en", "fr", "nl", "de" ]
}
}