Overview

Namespaces

  • None
  • Xmf
    • Database
    • Module
      • Helper
    • Template
  • Xoops
    • Auth
    • Core
      • Cache
      • Database
        • Logging
        • Schema
      • Exception
      • Handler
        • Scheme
      • Kernel
        • Dtype
        • Handlers
        • Model
      • Lists
      • Locale
        • Punic
      • Service
        • Contract
      • Session
      • Text
        • Sanitizer
          • Extensions
      • Theme
        • Plugins
    • Form
    • Html
    • Locale
    • Module
      • Helper
      • Plugin

Classes

  • Cache
  • Locale
  • Utils
  • Overview
  • Namespace
  • Class
  • Tree

Class Locale

Locale

Namespace: Xoops
Copyright: 2011-2015 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: trabis lusopoemas@gmail.com
Located at oops_lib/Xoops/Locale.php
Methods summary
public static string
# getCurrent( )

get the current active locale

get the current active locale

Returns

string
current locale
public static
# setCurrent( string $locale )

Set the current locale

Set the current locale

Parameters

$locale
local code

Throws

Punic\Exception\InvalidLocale
public static DateTimeZone
# getTimeZone( )

Get the current timezone

Get the current timezone

Returns

DateTimeZone
current timezone
public static
# setTimeZone( DateTimeZone $timeZone )

Set the current timezone

Set the current timezone

Parameters

$timeZone
protected static DateTimeZone
# newDateTimeZone( string $timeZoneName )

Instantiate a new DateTimeZone object for a timezone name, with fallback to UTC on error

Instantiate a new DateTimeZone object for a timezone name, with fallback to UTC on error

Parameters

$timeZoneName
name of timezone

Returns

DateTimeZone
public static DateTimeZone
# getDefaultTimeZone( )

Get the default timezone as set in default_TZ config

Get the default timezone as set in default_TZ config

Returns

DateTimeZone
public static DateTimeZone
# getSystemTimeZone( )

Get the server timezone as set in server_TZ config

Get the server timezone as set in server_TZ config

Returns

DateTimeZone
public static boolean
# loadLanguage( string $name, mixed $domain = '', string $language = null )

Parameters

$name
Name of language file to be loaded, without extension
$domain

string: Module dirname; global language file will be loaded if $domain is set to 'global' or not specified array: example; array('Frameworks/moduleclasses/moduleadmin')

$language
Language to be loaded, current language content will be loaded if not specified

Returns

boolean
public static boolean
# loadLocale( string $domain = null, string $forcedLocale = null )

Parameters

$domain
module dirname to load, if null will load global locale
$forcedLocale
Locale to be loaded, current language content will be loaded if not specified

Returns

boolean
public static boolean
# loadThemeLocale( Xoops\Core\Theme\XoopsTheme $theme )

load locale for theme

load locale for theme

Parameters

$theme

Returns

boolean
public static boolean
# loadMailerLocale( )

Returns

boolean
public static string
# translate( string $key, string $dirname = 'xoops' )

Parameters

$key
$dirname

Returns

string
public static string
# translateTheme( string $key, string $dirname = '' )

Parameters

$key
$dirname

Returns

string
protected static string
# getClassFromDirname( string $dirname )

Parameters

$dirname

Returns

string
protected static string
# getThemeClassFromDirname( string $dirname = '' )

Parameters

$dirname

Returns

string
public static array
# getUserLocales( )

getUserLocales() Returns the user locales Normally it returns an array like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. HTTP_ACCEPT_LANGUAGE 5. Fallback language Note: duplicate values are deleted.

getUserLocales() Returns the user locales Normally it returns an array like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. HTTP_ACCEPT_LANGUAGE 5. Fallback language Note: duplicate values are deleted.

Returns

array
with the user locales sorted by priority. Highest is best.
public static string
# normalizeLocale( string $locale, string $separator = '_', boolean $withScript = true )

Convert a locale designation to a normal form ll_Ssss_CC, where ll is language code Ssss is the script code, if specified CC is the country code, if specified

Convert a locale designation to a normal form ll_Ssss_CC, where ll is language code Ssss is the script code, if specified CC is the country code, if specified

Parameters

$locale
locale code
$separator
string to use to join locale parts
$withScript
include script if specified, always remove if false

Returns

string
normalized locale, or empty string on error
Constants summary
string FALLBACK_LOCALE
# 'en_US'
Properties summary
protected static $currentLocale
# null
protected static $currentTimeZone
# null
protected static $defaultTimeZone
# null
protected static $systemTimeZone
# null
protected static array $userLocales
# array()
API documentation generated by ApiGen