39 if ((empty($domain) ||
'global' == $domain)) {
42 $path = (is_array($domain)) ? array_shift($domain) :
"modules/{$domain}";
45 $fullPath =
$xoops->path(
"{$path}/language/{$language}/{$name}.php");
47 $fullPath2 =
$xoops->path(
"{$path}/language/english/{$name}.php");
62 if (
'xoops' == $domain) {
65 $path = (is_array($domain)) ? array_shift($domain) :
"modules/{$domain}";
67 $locales = self::getUserLocales();
68 foreach ($locales as $locale) {
69 $fullPath =
$xoops->path(
"{$path}/locale/{$locale}/locale.php");
70 $fullPath2 =
$xoops->path(
"{$path}/locale/{$locale}/{$locale}.php");
90 $locales = self::getUserLocales();
91 foreach ($locales as $locale) {
95 XoopsLoad::addMap(array(strtolower($theme->folderName .
'ThemeLocale') => $fullPath));
97 XoopsLoad::addMap(array(strtolower($theme->folderName .
"ThemeLocale{$locale}") => $fullPath2));
111 $locales = self::getUserLocales();
112 foreach ($locales as $locale) {
113 $fullPath =
$xoops->path(
"locale/{$locale}/mailer.php");
130 $class = self::getClassFromDirname(
$dirname);
131 if (defined(
"$class::$key")) {
132 return constant(
"$class::$key");
133 } elseif (defined($key)) {
134 return constant($key);
147 $class = self::getThemeClassFromDirname(
$dirname);
149 if (defined(
"$class::$key")) {
150 return constant(
"$class::$key");
151 } elseif (defined($key)) {
152 return constant($key);
164 return ucfirst(
$dirname) .
'Locale';
177 return ucfirst(
$dirname) .
'ThemeLocale';
195 if (empty(self::$_userLocales)) {
197 $userLocales = array();
205 if (isset($_GET[
'lang']) && is_string($_GET[
'lang'])) {
206 $userLocales[] = $_GET[
'lang'];
215 if (isset(
$_SERVER[
'HTTP_ACCEPT_LANGUAGE'])) {
216 foreach (explode(
',',
$_SERVER[
'HTTP_ACCEPT_LANGUAGE']) as $part) {
217 if (preg_match(
"/(.*);q=([0-1]{0,1}\.\d{0,4})/i", $part, $matches)) {
218 $userLocales[] = $matches[1];
220 $userLocales[] = $part;
228 $userLocales[] = static::$_defaultLocale;
230 $availableLocales = XoopsLists::getLocaleList();
232 foreach ($userLocales as $key => $value) {
233 $value = preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $value);
234 if ($value && in_array($value, $availableLocales)) {
235 self::$_userLocales[$key] = str_replace(
'-',
'_', $value);
241 self::$_userLocales = array_unique(self::$_userLocales);
243 return self::$_userLocales;
static getLegacyLanguage()
$_SESSION['RF']["verify"]
static translateTheme($key, $dirname= '')
static loadLanguage($name, $domain= '', $language=null)
static getClassFromDirname($dirname)
static loadThemeLocale(XoopsTheme $theme)
static loadMailerLocale()
static translate($key, $dirname= 'xoops')
static getThemeClassFromDirname($dirname= '')
static loadFile($file, $once=true)
static loadLocale($domain= 'xoops')
static addMap(array $map)