The language configuration is stored in app/config/app.php
are:
locale
- The default locale that will be used by the translation. Example: "en", "es", etc.
locales
- The available locales for translation. Example:
'locales' => array(
'en' => 'English',
'es' => 'Español',
),
Language strings are stored in files within the app/lang
directory. Within this directory there should be a subdirectory for each language supported by your website.
/app
/lang
/en
main.php
/es
main.php
echo Lang::get('main.login');
// OR
echo trans('main.login');
// OR
_e('main.login'); // <=> echo trans('main.login');
The first segment of the string passed to the get
method or trans
/_e
functions is the name of the language file, and the second is the name of the line that should be retrieved.
You may also define place-holders in your language lines:
'welcome' => 'Howdy, :name !',
Then, pass a second argument of replacements to the Lang::get
method or trans
/_e
functions:
echo trans('main.welcome', array('name' => 'User'));
This will output: Howdy, User !