Cuppa Documentation

Find information related with: installation, user interface, best practices, improve and extend de functionalities, front-end integration and more.
Language

load($file = "administrator", $language = null)

$language = $cuppa->language->load("web"); // return the language like a object

echo $language->read_more // print the translation of read_more in the language configured

getValue($key, $language_file_reference, $convert_to_url_friendy = false)

echo $cuppa->language->getValue('label', 'web'); // load the 'web' file and return the translate value with the label specified

getValueRich($label)

This method return the value created in the section Language Manager > Rich content

echo $cuppa->language->getValueRich('footer'); // return the content with the label 'footer' 

current()

$current = $cuppa->language->current(); // return the current language selected

set($language = "en", $forced = true)

$cuppa->language->set('es'); // Change the language to 'es'

languages()

$languages = $cuppa->language->languages(); // return the languages list in an array ['en', 'es', 'fr']

validLanguage($value)

$valid = $cuppa->language->validLanguage('es'); // return true or false if the language is available or not