aboutsummaryrefslogtreecommitdiffstats
path: root/include/language.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/language.php')
-rw-r--r--include/language.php52
1 files changed, 27 insertions, 25 deletions
diff --git a/include/language.php b/include/language.php
index 24a6a08ca..2e7ad5ff1 100644
--- a/include/language.php
+++ b/include/language.php
@@ -20,22 +20,22 @@ function get_browser_language() {
$langs = array();
if (x($_SERVER,'HTTP_ACCEPT_LANGUAGE')) {
- // break up string into pieces (languages and q factors)
- preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
+ // break up string into pieces (languages and q factors)
+ preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
- if (count($lang_parse[1])) {
- // create a list like "en" => 0.8
- $langs = array_combine($lang_parse[1], $lang_parse[4]);
-
- // set default to 1 for any without q factor
- foreach ($langs as $lang => $val) {
- if ($val === '') $langs[$lang] = 1;
- }
-
- // sort list based on value
- arsort($langs, SORT_NUMERIC);
- }
+ if (count($lang_parse[1])) {
+ // create a list like "en" => 0.8
+ $langs = array_combine($lang_parse[1], $lang_parse[4]);
+
+ // set default to 1 for any without q factor
+ foreach ($langs as $lang => $val) {
+ if ($val === '') $langs[$lang] = 1;
+ }
+
+ // sort list based on value
+ arsort($langs, SORT_NUMERIC);
+ }
}
else
$langs['en'] = 1;
@@ -60,7 +60,7 @@ function get_best_language() {
if(isset($preferred))
return $preferred;
- $a = get_app();
+ $a = get_app();
return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
}
@@ -99,7 +99,7 @@ function pop_lang() {
// load string translation table for alternate language
-function load_translation_table($lang) {
+function load_translation_table($lang, $install = false) {
global $a;
$a->strings = array();
@@ -107,15 +107,17 @@ function load_translation_table($lang) {
include("view/$lang/strings.php");
}
- $plugins = q("SELECT name FROM addon WHERE installed=1;");
- if ($plugins!==false) {
- foreach($plugins as $p) {
- $name = $p['name'];
- if(file_exists("addon/$name/lang/$lang/strings.php")) {
- include("addon/$name/lang/$lang/strings.php");
- }
- }
- }
+ if(! $install) {
+ $plugins = q("SELECT name FROM addon WHERE installed=1;");
+ if ($plugins!==false) {
+ foreach($plugins as $p) {
+ $name = $p['name'];
+ if(file_exists("addon/$name/lang/$lang/strings.php")) {
+ include("addon/$name/lang/$lang/strings.php");
+ }
+ }
+ }
+ }
// Allow individual strings to be over-ridden on this site
// Either for the default language or for all languages