Languages::getLocale() method

Return the current locale setting

If using LC_ALL category and locales change by category, the returned string will be in the format: “category=locale;category=locale”, and so on.

The first and second arguments may optionally be swapped and either can be omitted.


// basic usage
$string = $languages->getLocale();

// usage with all arguments
$string = $languages->getLocale($category = 6, $language = null);


category (optional)int, Language, string, null

Optionally specify a PHP LC constant (default=LC_ALL)

language (optional)Language, string, int, null

Optionally return locale for specific language (default=current locale, regardless of language)

Return value

string bool

Locale(s) string or boolean false if not supported by the system.


Method can throw exceptions on error:

  • WireException - if given a $language argument that is invalid

See Also

Languages methods and properties

API reference based on ProcessWire core version 3.0.160

Twitter updates

  • ProcessWire 3.0.161 adds support for selector operator stacking, enabling you automatically broaden searches in a single pages.find() call— More
    26 June 2020
  • ProcessWire 3.0.160 adds powerful new text-searching operators, bringing a new level of power to page-finding API calls, especially when it comes to search engine type queries. Post also includes a demo search engine where you can test it all out live— More
    19 June 2020
  • Preview of ProcessWire 3.0.160 with auto-enable of two-factor authentication, new version of TfaEmail and TfaTotp, and new selector operators coming next week. More
    12 June 2020

Latest news

  • ProcessWire Weekly #320
    In the 320th issue of ProcessWire Weekly we're going to check out the latest core updates (ProcessWire 3.0.161), a new third party module called Fieldtype Runtime only, an IndieWeb themed article from Francesco Schwarz, and more. Read on! / 27 June 2020
  • Powerful new text-searching abilities in 3.0.160
    In ProcessWire 3.0.160 we’ve got some major upgrades and additions to our text-search abilities. This brings a whole new level of power to $pages->find() and similar API calls, especially when it comes to search engine type queries.
    Blog / 19 June 2020
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer