+ /**
+ * Check system support for given language nedded for gettext.
+ */
+ function check_support($lang_code, $encoding)
+ {
+ $old = setlocale(LC_MESSAGES, '0');
+ $up = strtoupper($encoding);
+ $low = strtolower($encoding);
+ $lshort = strtr($up, '-','');
+ $ushort = strtr($low, '-','');
+
+ $test = setlocale(LC_MESSAGES,
+ $lang_code.".".$encoding,
+ $lang_code.".".$up,
+ $lang_code.".".$low,
+ $lang_code.".".$ushort,
+ $lang_code.".".$lshort) !== false;
+
+ setlocale(LC_MESSAGES, $old);
+ return $test;
+ }