aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/language.php58
-rw-r--r--include/text.php36
2 files changed, 58 insertions, 36 deletions
diff --git a/include/language.php b/include/language.php
index 96d3e48a9..efe9397fb 100644
--- a/include/language.php
+++ b/include/language.php
@@ -327,3 +327,61 @@ function get_language_name($s, $l = null) {
return $language->getName();
}
+
+
+
+function language_list() {
+
+ $langs = glob('view/*/hstrings.php');
+
+ $lang_options = array();
+ $selected = "";
+
+ if(is_array($langs) && count($langs)) {
+ if(! in_array('view/en/hstrings.php',$langs))
+ $langs[] = 'view/en/';
+ asort($langs);
+ foreach($langs as $l) {
+ $ll = substr($l,5);
+ $ll = substr($ll,0,strrpos($ll,'/'));
+ $lang_options[$ll] = get_language_name($ll, $ll) . " ($ll)";
+ }
+ }
+ return $lang_options;
+}
+
+function lang_selector() {
+
+ $langs = glob('view/*/hstrings.php');
+
+ $lang_options = array();
+ $selected = "";
+
+ if(is_array($langs) && count($langs)) {
+ $langs[] = '';
+ if(! in_array('view/en/hstrings.php',$langs))
+ $langs[] = 'view/en/';
+ asort($langs);
+ foreach($langs as $l) {
+ if($l == '') {
+ $lang_options[""] = t('default');
+ continue;
+ }
+ $ll = substr($l,5);
+ $ll = substr($ll,0,strrpos($ll,'/'));
+ $selected = (($ll === App::$language && (x($_SESSION, 'language'))) ? $ll : $selected);
+ $lang_options[$ll] = get_language_name($ll, $ll) . " ($ll)";
+ }
+ }
+
+ $tpl = get_markup_template('lang_selector.tpl');
+
+ $o = replace_macros($tpl, array(
+ '$title' => t('Select an alternate language'),
+ '$langs' => array($lang_options, $selected),
+
+ ));
+
+ return $o;
+}
+
diff --git a/include/text.php b/include/text.php
index 9c4a4a5c5..2f89d3d98 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1837,42 +1837,6 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
return $o;
}
-
-function lang_selector() {
-
- $langs = glob('view/*/hstrings.php');
-
- $lang_options = array();
- $selected = "";
-
- if(is_array($langs) && count($langs)) {
- $langs[] = '';
- if(! in_array('view/en/hstrings.php',$langs))
- $langs[] = 'view/en/';
- asort($langs);
- foreach($langs as $l) {
- if($l == '') {
- $lang_options[""] = t('default');
- continue;
- }
- $ll = substr($l,5);
- $ll = substr($ll,0,strrpos($ll,'/'));
- $selected = (($ll === App::$language && (x($_SESSION, 'language'))) ? $ll : $selected);
- $lang_options[$ll] = get_language_name($ll, $ll) . " ($ll)";
- }
- }
-
- $tpl = get_markup_template("lang_selector.tpl");
- $o = replace_macros($tpl, array(
- '$title' => t('Select an alternate language'),
- '$langs' => array($lang_options, $selected),
-
- ));
-
- return $o;
-}
-
-
function engr_units_to_bytes ($size_str) {
if(! $size_str)
return $size_str;