Skip to main content

Intl Filters

Internationalization filters using PHP's Intl extension. These filters are only available when the PHP intl extension is loaded.

Name Lookups

FilterArgumentsDescription
country_namelocaleGet country name from code
currency_namelocaleGet currency name from code
currency_symbollocaleGet currency symbol from code
language_namelocaleGet language name from code
locale_namelocaleGet locale name from code
timezone_namelocaleGet timezone name from identifier

All filters accept an optional locale argument (defaults to WordPress locale).

{{ 'US'|country_name }}                        <!-- United States -->
{{ 'FR'|country_name }} <!-- France -->
{{ 'FR'|country_name('fr_FR') }} <!-- France (in French) -->

{{ 'USD'|currency_name }} <!-- US Dollar -->
{{ 'EUR'|currency_name }} <!-- Euro -->

{{ 'USD'|currency_symbol }} <!-- $ -->
{{ 'EUR'|currency_symbol }} <!-- € -->

{{ 'en'|language_name }} <!-- English -->
{{ 'fr'|language_name }} <!-- French -->
{{ 'fr'|language_name('fr_FR') }} <!-- français -->

{{ 'en_US'|locale_name }} <!-- English (United States) -->
{{ 'fr_FR'|locale_name }} <!-- French (France) -->

{{ 'Europe/Paris'|timezone_name }} <!-- Central European Time -->
{{ 'America/New_York'|timezone_name }} <!-- Eastern Time -->

Number Formatting

FilterArgumentsDescription
format_currencycurrency, localeFormat as currency
format_numberstyle, locale, attrsFormat number

format_currency

Arguments:

  • currency — Currency code (default: 'USD')
  • locale — Locale code (default: WordPress locale)
{{ 1234.56|format_currency('USD') }}           <!-- $1,234.56 -->
{{ 1234.56|format_currency('EUR') }} <!-- €1,234.56 -->
{{ 1234.56|format_currency('EUR', 'de_DE') }} <!-- 1.234,56 € -->
{{ 1234.56|format_currency('GBP', 'en_GB') }} <!-- £1,234.56 -->

format_number

Arguments:

  • style — Format style (default: 'decimal')
  • locale — Locale code (default: WordPress locale)
  • attrs — Additional formatter attributes (optional)

Style options:

  • 'decimal' — Standard decimal number
  • 'currency' — Currency format
  • 'percent' — Percentage format
  • 'scientific' — Scientific notation
  • 'spellout' — Number spelled out in words
  • 'ordinal' — Ordinal format (1st, 2nd, 3rd)
  • 'duration' — Duration format
{{ 1234.56|format_number }}                    <!-- 1,234.56 -->
{{ 1234.56|format_number('decimal') }}
{{ 0.75|format_number('percent') }} <!-- 75% -->
{{ 1234|format_number('spellout') }} <!-- one thousand two hundred thirty-four -->
{{ 3|format_number('ordinal') }} <!-- 3rd -->

Date/Time Formatting

FilterArgumentsDescription
format_datedateFormat, locale, pattern, timezoneFormat date
format_timetimeFormat, locale, pattern, timezoneFormat time
format_datetimedateFormat, timeFormat, locale, pattern, timezoneFormat date and time

Format options:

  • 'none' — No output
  • 'short' — Short format
  • 'medium' — Medium format (default)
  • 'long' — Long format
  • 'full' — Full format

format_date

{{ post.date|format_date }}                    <!-- Jan 15, 2024 -->
{{ post.date|format_date('short') }} <!-- 1/15/24 -->
{{ post.date|format_date('medium') }} <!-- Jan 15, 2024 -->
{{ post.date|format_date('long') }} <!-- January 15, 2024 -->
{{ post.date|format_date('full') }} <!-- Monday, January 15, 2024 -->
{{ post.date|format_date('long', 'fr_FR') }} <!-- 15 janvier 2024 -->

format_time

{{ post.date|format_time }}                    <!-- 2:30:00 PM -->
{{ post.date|format_time('short') }} <!-- 2:30 PM -->
{{ post.date|format_time('medium') }} <!-- 2:30:00 PM -->
{{ post.date|format_time('long') }} <!-- 2:30:00 PM EST -->

format_datetime

{{ post.date|format_datetime }}
{{ post.date|format_datetime('medium', 'short') }}
{{ post.date|format_datetime('long', 'short', 'fr_FR') }}

Common Patterns

Localized currency display

{{ product.price|format_currency('USD') }}

Localized date

{{ post.date|format_date('long') }}

Country selector label

{{ country_code|country_name }}