Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | List of all members
SMW\Localizer Class Reference

Public Member Functions

 __construct (Language $contentLanguage)
 
 getContentLanguage ()
 
 getUserLanguage ()
 
 hasLocalTimeOffsetPreference ( $user=null)
 
 getLocalTime (DateTime $dateTime, $user=null)
 
 getPreferredContentLanguage ( $title=null)
 
 getLanguage ( $languageCode='')
 
 getLang ( $language='')
 
 getNamespaceTextById ( $index)
 
 getCanonicalNamespaceTextById ( $index)
 
 getNamespaceIndexByName ( $namespaceName)
 
 createTextWithNamespacePrefix ( $index, $text)
 
 getCanonicalizedUrlByNamespace ( $index, $url)
 

Static Public Member Functions

static getInstance ()
 
static clear ()
 
static isKnownLanguageTag ( $languageCode)
 
static asBCP47FormattedLanguageCode ( $languageCode)
 
static getLanguageCodeFrom (&$value)
 
static getAnnotatedLanguageCodeFrom (&$value)
 
static convertDoubleWidth ( $string)
 

Detailed Description

GNU GPL v2+

Since
2.1
Author
mwjames

Constructor & Destructor Documentation

◆ __construct()

SMW\Localizer::__construct ( Language  $contentLanguage)
Since
2.1
Parameters
Language$contentLanguage

Member Function Documentation

◆ asBCP47FormattedLanguageCode()

static SMW\Localizer::asBCP47FormattedLanguageCode (   $languageCode)
static
See also
IETF language tag / BCP 47 standards
Since
2.4
Parameters
string$languageCode
Returns
string

◆ clear()

static SMW\Localizer::clear ( )
static
Since
2.1

◆ convertDoubleWidth()

static SMW\Localizer::convertDoubleWidth (   $string)
static
See also
Language::convertDoubleWidth

Convert double-width roman characters to single-width. range: ff00-ff5f ~= 0020-007f

Parameters
string$string
Returns
string

◆ createTextWithNamespacePrefix()

SMW\Localizer::createTextWithNamespacePrefix (   $index,
  $text 
)
Since
2.5
Parameters
integer$index
string$text
Returns
string

◆ getAnnotatedLanguageCodeFrom()

static SMW\Localizer::getAnnotatedLanguageCodeFrom ( $value)
static
Since
2.4
Parameters
string&$value
Returns
string|false

◆ getCanonicalizedUrlByNamespace()

SMW\Localizer::getCanonicalizedUrlByNamespace (   $index,
  $url 
)
Since
2.5
Parameters
integer$ns
string$url
Returns
string

◆ getCanonicalNamespaceTextById()

SMW\Localizer::getCanonicalNamespaceTextById (   $index)
Since
2.5
Parameters
integer$index
Returns
string

◆ getContentLanguage()

SMW\Localizer::getContentLanguage ( )
Since
2.1
Returns
Language

◆ getInstance()

static SMW\Localizer::getInstance ( )
static
Since
2.1
Returns
Localizer

◆ getLang()

SMW\Localizer::getLang (   $language = '')
Since
2.4
Parameters
Language | string$languageCode
Returns
Lang

◆ getLanguage()

SMW\Localizer::getLanguage (   $languageCode = '')
Since
2.4
Parameters
string$languageCode
Returns
Language

◆ getLanguageCodeFrom()

static SMW\Localizer::getLanguageCodeFrom ( $value)
static
Deprecated:
2.5, use Localizer::getAnnotatedLanguageCodeFrom instead
Since
2.4
Parameters
string&$value
Returns
string|false

◆ getLocalTime()

SMW\Localizer::getLocalTime ( DateTime  $dateTime,
  $user = null 
)
Since
3.0
Parameters
DateTime$dateTime
User | null$user
Returns
DateTime

◆ getNamespaceIndexByName()

SMW\Localizer::getNamespaceIndexByName (   $namespaceName)
Since
2.1
Parameters
string$namespaceName
Returns
integer|boolean

◆ getNamespaceTextById()

SMW\Localizer::getNamespaceTextById (   $index)
Since
2.1
Parameters
integer$index
Returns
string

◆ getPreferredContentLanguage()

SMW\Localizer::getPreferredContentLanguage (   $title = null)
Note
  1. If the page content language is available use it as preferred language (as it is clear that the page content was intended to be in a specific language)
  2. If no page content language was assigned use the global content language

General rules:

  • Special pages are in the user language
  • Display of values (DV) should use the user language if available otherwise use the content language as fallback
  • Storage of values (DI) should always use the content language

Notes:

  • The page content language is the language in which the content of a page is written in wikitext
Since
2.4
Parameters
DIWikiPage | Title | null$title
Returns
Language

◆ getUserLanguage()

SMW\Localizer::getUserLanguage ( )
Since
2.4
Returns
Language

◆ hasLocalTimeOffsetPreference()

SMW\Localizer::hasLocalTimeOffsetPreference (   $user = null)
Since
3.0
Parameters
User | null$user
Returns
boolean

◆ isKnownLanguageTag()

static SMW\Localizer::isKnownLanguageTag (   $languageCode)
static
Since
2.4
Parameters
string$languageCode
Returns
boolean

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy