Last active
December 20, 2015 10:31
-
-
Save bosskovic/6116466 to your computer and use it in GitHub Desktop.
An example of language file loading and use in the FuelPHP framework.
Source: http://fuelphp.com/dev-docs/classes/lang.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// source: http://fuelphp.com/dev-docs/classes/lang.html | |
// Example of a language file: | |
return array( | |
'hello' => 'Hello :name', | |
'something'=> 'something :name!', | |
'test'=> array('hello' => 'Hello', 'something' => 'Plop') // Group | |
); | |
// Loads example.php. | |
// Note: If no language is set in the config, it will fallback to English. | |
Lang::load('example'); | |
// Will load the given file into the 'test' group. | |
Lang::load('example', 'test'); | |
// Outputs Plop | |
$this->output = Lang::get('test.test.something'); | |
//Outputs Hello world | |
$this->output = Lang::get('hello', array('name' => 'world')); | |
// Will load the example language file from the module 'foo' into the 'bar' group. | |
Lang::load('foo::example', 'bar'); | |
// Will load the example language file in italian. | |
// If that doesn't exist, it will load the configured language | |
Lang::load('foo::example', 'bar', 'it'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment