PHP Класс Prado\I18N\TGlobalization

TGlobalization can be subclassed to change how the Culture, Charset are determined. See TGlobalizationAutoDetect for example of setting the Culture based on browser settings.
С версии: 3.0
Наследование: extends Prado\TModule
Показать файл Открыть проект

Открытые методы

Метод Описание
getCharset ( ) : string
getCulture ( ) : string
getCultureVariants ( string $culture = null ) : array Gets all the variants of a specific culture. If the parameter $culture is null, the current culture is used.
getDefaultCharset ( ) : string
getDefaultCulture ( ) : string
getLocalizedResource ( $file, $culture = null ) : array Returns a list of possible localized files. Example $files = $app->getLocalizedResource("path/to/Home.page","en_US"); will return
array
  0 => 'path/to/en_US/Home.page'
  1 => 'path/to/en/Home.page'
  2 => 'path/to/Home.en_US.page'
  3 => 'path/to/Home.en.page'
  4 => 'path/to/Home.page'
Note that you still need to verify the existance of these files.
getTranslateDefaultCulture ( ) : string
getTranslationCatalogue ( ) : string
getTranslationConfiguration ( ) : TMap
init ( $config ) Initialize the Culture and Charset for this application.
setCharset ( $charset )
setCulture ( $culture )
setDefaultCharset ( $charset )
setDefaultCulture ( $culture )
setTranslateDefaultCulture ( $value )
setTranslationCatalogue ( $value )

Защищенные методы

Метод Описание
setTranslationConfiguration ( $config ) Sets the translation configuration. Example configuration: $config['type'] = 'XLIFF'; //XLIFF, gettext, Database or MySQL (deprecated) $config['source'] = 'Path.to.directory'; // for types XLIFF and gettext $config['source'] = 'connectionId'; // for type Database $config['source'] = 'mysql://user:pw@host/db'; // for type MySQL (deprecated) $config['catalogue'] = 'messages'; //default catalog $config['autosave'] = 'true'; //save untranslated message $config['cache'] = 'true'; //cache translated message $config['marker'] = '@@'; // surround untranslated text with '@@' Throws exception is source is not found.

Описание методов

getCharset() публичный Метод

public getCharset ( ) : string
Результат string localization charset

getCulture() публичный Метод

public getCulture ( ) : string
Результат string current application culture

getCultureVariants() публичный Метод

Gets all the variants of a specific culture. If the parameter $culture is null, the current culture is used.
public getCultureVariants ( string $culture = null ) : array
$culture string the Culture string
Результат array variants of the culture.

getDefaultCharset() публичный Метод

public getDefaultCharset ( ) : string
Результат string default charset set

getDefaultCulture() публичный Метод

public getDefaultCulture ( ) : string
Результат string default culture

getLocalizedResource() публичный Метод

Returns a list of possible localized files. Example $files = $app->getLocalizedResource("path/to/Home.page","en_US"); will return
array
  0 => 'path/to/en_US/Home.page'
  1 => 'path/to/en/Home.page'
  2 => 'path/to/Home.en_US.page'
  3 => 'path/to/Home.en.page'
  4 => 'path/to/Home.page'
Note that you still need to verify the existance of these files.
public getLocalizedResource ( $file, $culture = null ) : array
Результат array list of possible localized resource files.

getTranslateDefaultCulture() публичный Метод

public getTranslateDefaultCulture ( ) : string
Результат string default culture

getTranslationCatalogue() публичный Метод

public getTranslationCatalogue ( ) : string
Результат string current translation catalogue.

getTranslationConfiguration() публичный Метод

public getTranslationConfiguration ( ) : TMap
Результат TMap translation source configuration.

init() публичный Метод

You should override this method if you want a different way of setting the Culture and/or Charset for your application. If you override this method, call parent::init($xml) first.
public init ( $config )

setCharset() публичный Метод

public setCharset ( $charset )

setCulture() публичный Метод

public setCulture ( $culture )

setDefaultCharset() публичный Метод

public setDefaultCharset ( $charset )

setDefaultCulture() публичный Метод

public setDefaultCulture ( $culture )

setTranslateDefaultCulture() публичный Метод

public setTranslateDefaultCulture ( $value )

setTranslationCatalogue() публичный Метод

public setTranslationCatalogue ( $value )

setTranslationConfiguration() защищенный Метод

Sets the translation configuration. Example configuration: $config['type'] = 'XLIFF'; //XLIFF, gettext, Database or MySQL (deprecated) $config['source'] = 'Path.to.directory'; // for types XLIFF and gettext $config['source'] = 'connectionId'; // for type Database $config['source'] = 'mysql://user:pw@host/db'; // for type MySQL (deprecated) $config['catalogue'] = 'messages'; //default catalog $config['autosave'] = 'true'; //save untranslated message $config['cache'] = 'true'; //cache translated message $config['marker'] = '@@'; // surround untranslated text with '@@' Throws exception is source is not found.
protected setTranslationConfiguration ( $config )