l($key, $default = null)

Fetches a language variable for multi-language sites

  • $key (string)
  • $default (mixed)
    Default value if empty
  • return (mixed)

For multi-language sites you can set custom language variables in /site/languages. Create a language file for each available language.

/site/languages/en.php
/site/languages/de.php

In each of those files you can set as many translatable variables as you like.

// in /site/languages/en.php
l::set('submit', 'Submit');
l::set('subscribe', 'Subscribe')

// in /site/languages/de.php
l::set('submit', 'Abschicken');
l::set('subscribe', 'Anmelden')

Those variables can be fetched in your templates and snippets with the l() helper.

<button><?php echo l('submit') ?></button>

When a user switches the language of the site, the button will automatically be translated.

The l() helper is a shortcut for l::get(). You can use both.