+/**
+ * php setlocale function wrapper
+ *
+ * From php 4.3.0 it is possible to use arrays in order to set locale.
+ * php gettext extension works only when locale is set. This wrapper
+ * function allows to use more than one locale name.
+ *
+ * @param int $category locale category name. Use php named constants
+ * (LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME)
+ * @param mixed $locale option contains array with possible locales or string with one locale
+ * @return string name of set locale or false, if all locales fail.
+ * @since 1.5.1 and 1.4.5
+ * @see http://www.php.net/setlocale
+ */
+function sq_setlocale($category,$locale) {
+ // string with only one locale
+ if (is_string($locale))
+ return setlocale($category,$locale);
+
+ if (! check_php_version(4,3)) {
+ $ret=false;
+ $index=0;
+ while ( ! $ret && $index<count($locale)) {
+ $ret=setlocale($category,$locale[$index]);
+ $index++;
+ }
+ } else {
+ // php 4.3.0 or better, use entire array
+ $ret=setlocale($category,$locale);
+ }
+ return $ret;
+}
+