+}}
+
+// provide a fallback which will not collide with
+// a function defined in any language file
+
+if(! function_exists('string_plural_select_default')) {
+function string_plural_select_default($n) {
+ return ($n != 1);
+}}
+
+
+/**
+ * Return installed languages as associative array
+ * [
+ * lang => lang,
+ * ...
+ * ]
+ */
+function get_avaiable_languages() {
+ $lang_choices = array();
+ $langs = glob('view/*/strings.php'); /**/
+
+ if(is_array($langs) && count($langs)) {
+ if(! in_array('view/en/strings.php',$langs))
+ $langs[] = 'view/en/';
+ asort($langs);
+ foreach($langs as $l) {
+ $t = explode("/",$l);
+ $lang_choices[$t[1]] = $t[1];
+ }
+ }
+ return $lang_choices;
+}