Migrate app_languages.php from core to resources

This commit is contained in:
Matthew Vale
2015-12-10 09:57:08 +00:00
parent 3df36af619
commit e4c711e8f7
2 changed files with 8 additions and 4 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
// Fill in the value in the native language
// rename the corerct flag in /theme/flags/*.png
$language_name['en-us'] = "English - United States";
$language_name['es-cl'] = "Español - Chile";
$language_name['pt-pt'] = "Português - Portugal";
$language_name['fr-fr'] = "Français - France";
$language_name['nl-nl'] = "Nederlands - De Nederland";
$language_name['pt-br'] = "Brasileiro - Português";
$language_name['pl'] = "Polski - Polska";
$language_name['sv-se'] = "Svenska - Sverige";
$language_name['uk'] = "Українська - Україна";
$language_name['de-at'] = "Deutsch - Österreich";
$language_name['ar-eg'] = "العربية - مصر";
?>
+8 -4
View File
@@ -27,14 +27,18 @@ class text {
*/
public function get($language_code = null, $app_path = null) {
//get the global app_languages.php
include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/app_languages.php";
include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/app_languages.php";
//get the app_languages.php
if ($app_path != null) {
include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php";
$lang_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php";
}
else {
include getcwd().'/app_languages.php';
$lang_path = getcwd().'/app_languages.php';
}
if(file_exists($lang_path)){
require $lang_path;
}
//get the available languages
krsort($text);
foreach ($text as $lang_label => $lang_codes) {
@@ -46,7 +50,7 @@ class text {
}
$_SESSION['app']['languages'] = array_unique($app_languages);
//check the session language
if(isset($_SESSION['domain'])){
if(isset($_SESSION['domain']) and $language_code == null){
$language_code = $_SESSION['domain']['language']['code'];
}elseif($language_code == null){
$language_code = 'en-us';