languages() function

Access all installed languages in multi-language environment ($languages API variable as a function)

Returns the $languages API variable, or a Language object if given a language name or ID.

Example

$languages = languages(); // Languages if active, null if not
$en = languages()->getDefault(); // Get default language
$de = languages()->get('de'); // Get another language
$de = languages('de'); // Get another language (shorcut syntax)

Usage

// basic usage
$languages = languages();

// usage with all arguments
$languages = languages($name = '');

Arguments

NameType(s)Description
name (optional)string, int

Optional Language name or ID for language to retrieve

Return value

Languages Language NullPage null

See Also


Functions methods and properties

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • ProcessWire 3.0.146 on the dev branch contains about 22 commits with a combination of useful upgrades and issue report resolutions, more details in this forum post: More
    22 November 2019
  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019
  • ProcessWire 3.0.144 core updates: Upgraded overrides section in the field editor, a new Inputfields JS API, and more— More
    1 November 2019

Latest news

  • ProcessWire Weekly #290
    In the 290th issue of ProcessWire Weekly we're going to introduce the latest addition to the ProDevTools module package and a third party image picker field from gebeer, check out a new site of the week, and more. Read on!
    Weekly.pw / 30 November 2019
  • New User Activity module
    Blog / 29 November 2019
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits