The extension is installable via composer:
composer require anezi/locale-extension
services:
anezi_twig.locale_extension:
class: Anezi\Locale\Twig\Extension\LocaleExtension
public: false
arguments: ["%managed_locales%"]
tags:
- { name: twig.extension }
{% for locale in locales() %}{{ locale }} - {% endfor %}
shows:
ar - en - fr -
{{ "be"|country_name }}
shows:
Belgium
{{ "fr_BE"|locale_name }}
shows:
French (Belgium)
{{ "fr_BE"|origin_locale_name }}
shows:
français (Belgique)
{{ "fr_BE"|locale_short_name }}
shows:
fr
{{ "ar"|html_dir }}
shows:
rtl