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 ()
 
 getPreferredContentLanguage ($title=null)
 
 getLanguage ($languageCode= '')
 
 getExtraneousLanguage ($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

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

Member Function Documentation

static SMW\Localizer::asBCP47FormattedLanguageCode (   $languageCode)
static
See also
IETF language tag / BCP 47 standards
Since
2.4
Parameters
string$languageCode
Returns
string
static SMW\Localizer::clear ( )
static
Since
2.1
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
SMW\Localizer::createTextWithNamespacePrefix (   $index,
  $text 
)
Since
2.5
Parameters
integer$index
string$text
Returns
string
static SMW\Localizer::getAnnotatedLanguageCodeFrom ( $value)
static
Since
2.4
Parameters
string&$value
Returns
string|false
SMW\Localizer::getCanonicalizedUrlByNamespace (   $index,
  $url 
)
Since
2.5
Parameters
integer$ns
string$url
Returns
string
SMW\Localizer::getCanonicalNamespaceTextById (   $index)
Since
2.5
Parameters
integer$index
Returns
string
SMW\Localizer::getContentLanguage ( )
Since
2.1
Returns
Language
SMW\Localizer::getExtraneousLanguage (   $language = '')
Since
2.4
Parameters
Language | string$languageCode
Returns
ExtraneousLanguage
static SMW\Localizer::getInstance ( )
static
Since
2.1
Returns
Localizer
SMW\Localizer::getLanguage (   $languageCode = '')
Since
2.4
Parameters
string$languageCode
Returns
Language
static SMW\Localizer::getLanguageCodeFrom ( $value)
static
Deprecated:
2.5, use Localizer::getAnnotatedLanguageCodeFrom instead
Since
2.4
Parameters
string&$value
Returns
string|false
SMW\Localizer::getNamespaceIndexByName (   $namespaceName)
Since
2.1
Parameters
string$namespaceName
Returns
integer|boolean
SMW\Localizer::getNamespaceTextById (   $index)
Since
2.1
Parameters
integer$index
Returns
string
SMW\Localizer::getPreferredContentLanguage (   $title = null)
Note
  1. If the page content language is availabe 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
SMW\Localizer::getUserLanguage ( )
Since
2.4
Returns
Language
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: