-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '31-internationalization-translations'
- Loading branch information
Showing
40 changed files
with
2,392 additions
and
151 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
// Language to use | ||
$config['default_language'] = 'english'; | ||
|
||
// Supported languages | ||
$config['supported_languages'] = array( | ||
'english' => 'en_US', | ||
'polish' => 'pl_PL' | ||
); |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
class Plain_Lang extends CI_Lang { | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
/** | ||
* Load a language file | ||
* | ||
* @access public | ||
* @param mixed the name of the language file to be loaded. Can be an array | ||
* @param string the language (english, etc.) | ||
* @param bool return loaded array of translations | ||
* @param bool add suffix to $langfile | ||
* @param string alternative path to look for language file | ||
* @return mixed | ||
*/ | ||
function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') | ||
{ | ||
$langfile = str_replace('.php', '', $langfile); | ||
|
||
if ($add_suffix == TRUE) | ||
{ | ||
$langfile = str_replace('_lang.', '', $langfile).'_lang'; | ||
} | ||
|
||
$langfile .= '.php'; | ||
|
||
if (in_array($langfile, $this->is_loaded, TRUE)) | ||
{ | ||
return; | ||
} | ||
|
||
$config =& get_config(); | ||
|
||
if ($idiom == '') | ||
{ | ||
$deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; | ||
$idiom = ($deft_lang == '') ? 'english' : $deft_lang; | ||
} | ||
|
||
// Determine where the language file is and load it | ||
if ($alt_path != '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) | ||
{ | ||
include($alt_path.'language/'.$idiom.'/'.$langfile); | ||
} | ||
else | ||
{ | ||
$found = FALSE; | ||
// Places to search for language files - system, application and custom folders in that order | ||
// This way custom entries override application ones which override system ones | ||
$lookupPaths = array(); | ||
array_push($lookupPaths, BASEPATH); | ||
array_push($lookupPaths, APPPATH); | ||
array_push($lookupPaths, CUSTOMPATH); | ||
foreach ($lookupPaths as $package_path) | ||
{ | ||
if (file_exists($package_path.'language/'.$idiom.'/'.$langfile)) | ||
{ | ||
include($package_path.'language/'.$idiom.'/'.$langfile); | ||
$found = TRUE; | ||
} | ||
} | ||
|
||
if ($found !== TRUE) | ||
{ | ||
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); | ||
} | ||
} | ||
|
||
|
||
if ( ! isset($lang)) | ||
{ | ||
log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); | ||
return; | ||
} | ||
|
||
if ($return == TRUE) | ||
{ | ||
return $lang; | ||
} | ||
|
||
$this->is_loaded[] = $langfile; | ||
$this->language = array_merge($this->language, $lang); | ||
unset($lang); | ||
|
||
log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); | ||
return TRUE; | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.