aboutsummaryrefslogtreecommitdiffstats
path: root/include/language.php
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-10-03 17:16:24 -0700
committerredmatrix <mike@macgirvin.com>2016-10-03 17:16:24 -0700
commitcef1aa6d1b21b15458783661ed4c7e6fe8a99011 (patch)
treed1347dc658e7d71ad44abd4fdb691a31e219c364 /include/language.php
parent5b10db6f91f4bb876bbadbc9602c68762a3c9b71 (diff)
downloadvolse-hubzilla-cef1aa6d1b21b15458783661ed4c7e6fe8a99011.tar.gz
volse-hubzilla-cef1aa6d1b21b15458783661ed4c7e6fe8a99011.tar.bz2
volse-hubzilla-cef1aa6d1b21b15458783661ed4c7e6fe8a99011.zip
add some more stuff to admin/account_edit (service class, language, and techlevel if appropriate). Fix en-au and en-gb so they are listed as languages, and move language selector stuff to include/language.php instead of include/text.php; new file Zotlabs/Lib/Techlevels.php so we only need to write the selection array once.
Diffstat (limited to 'include/language.php')
-rw-r--r--include/language.php58
1 files changed, 58 insertions, 0 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;
+}
+