Localization

Localization

The skeleton app comes with a library for outputting translated strings. It does not translate for you, but will output the appropriate string depending on what locale you are using. The locale object is configured in the dependencies file.

dependencies.php

1
2
3
4
5
6
<?php
$container['locale'] = function () {
    $locale = new \Vespula\Locale\Locale('en_CA');
    $locale->load(__DIR__ . '/Locales');
    return $locale;
};

In your view template...

1
2
<?php
echo $locale->gettext('TEXT_HELLO');

Information on setting up and using the locale class, please refer to its documentation.