Class TGlobalization

Description

TGlobalization contains settings for Culture, Charset and TranslationConfiguration.

TGlobalization can be subclassed to change how the Culture, Charset are determined. See TGlobalizationAutoDetect for example of setting the Culture based on browser settings.

Located in /I18N/TGlobalization.php (line 27)

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --TGlobalization
Direct descendents
Class Description
TGlobalizationAutoDetect TGlobalizationAutoDetect class will automatically try to resolve the default culture using the user browser language settings.
Method Summary
string getCharset ()
string getCulture ()
array getCultureVariants ([string $culture = null])
string getDefaultCharset ()
string getDefaultCulture ()
array getLocalizedResource (string $file, [string $culture = null])
void init (mixed $config)
void setCharset (string $charset)
void setCulture (string $culture)
void setDefaultCharset (string $charset)
void setDefaultCulture (string $culture)
void setTranslateDefaultCulture (bool $value)
void setTranslationCatalogue (string $value)
void setTranslationConfiguration (TMap|array $config)
Methods
getCharset (line 160)
  • return: localization charset
  • access: public
string getCharset ()
getCulture (line 144)
  • return: current application culture
  • access: public
string getCulture ()
getCultureVariants (line 254)

Gets all the variants of a specific culture. If the parameter $culture is null, the current culture is used.

  • return: variants of the culture.
  • access: public
array getCultureVariants ([string $culture = null])
  • string $culture: the Culture string
getDefaultCharset (line 128)
  • return: default charset set
  • access: public
string getDefaultCharset ()
getDefaultCulture (line 112)
  • return: default culture
  • access: public
string getDefaultCulture ()
getLocalizedResource (line 283)

Returns a list of possible localized files. Example

  1.  $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.

  • return: list of possible localized resource files.
  • access: public
array getLocalizedResource (string $file, [string $culture = null])
  • string $file: filename
  • string $culture: culture string, null to use current culture
getTranslateDefaultCulture (line 96)
  • return: default culture
  • access: public
string getTranslateDefaultCulture ()
getTranslationCatalogue (line 235)
  • return: current translation catalogue.
  • access: public
string getTranslationCatalogue ()
getTranslationConfiguration (line 176)
  • return: translation source configuration.
  • access: public
TMap getTranslationConfiguration ()
init (line 71)

Initialize the Culture and Charset for this application.

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.

  • access: public
void init (mixed $config)
  • mixed $config: application configuration

Redefinition of:
TModule::init()
Initializes the module.

Redefined in descendants as:
setCharset (line 168)
  • access: public
void setCharset (string $charset)
  • string $charset: localization charset, e.g. <tt>UTF-8</tt>
setCulture (line 152)
  • access: public
void setCulture (string $culture)
  • string $culture: culture, e.g. <tt>en_US</tt> for American English
setDefaultCharset (line 136)
  • access: public
void setDefaultCharset (string $charset)
  • string $charset: default localization charset, e.g. <tt>UTF-8</tt>
setDefaultCulture (line 120)
  • access: public
void setDefaultCulture (string $culture)
  • string $culture: default culture, e.g. <tt>en_US</tt> for American English
setTranslateDefaultCulture (line 104)
  • access: public
void setTranslateDefaultCulture (bool $value)
  • bool $value: default culture, e.g. <tt>en_US</tt> for American English
setTranslationCatalogue (line 243)
  • access: public
void setTranslationCatalogue (string $value)
  • string $value: update the translation catalogue.
setTranslationConfiguration (line 198)

Sets the translation configuration. Example configuration:

  1.  $config['type''XLIFF'//XLIFF, gettext, Database or MySQL (deprecated)
  2.  $config['source''Path.to.directory'// for types XLIFF and gettext
  3.  $config['source''connectionId'// for type Database
  4.  $config['source''mysql://user:pw@host/db'// for type MySQL (deprecated)
  5.  $config['catalogue''messages'//default catalog
  6.  $config['autosave''true'//save untranslated message
  7.  $config['cache''true'//cache translated message
  8.  $config['marker''@@'// surround untranslated text with '@@'
Throws exception is source is not found.

  • access: protected
void setTranslationConfiguration (TMap|array $config)
  • TMap|array $config: configuration options

Inherited Methods

Inherited From TModule

TModule::getID()
TModule::init()
TModule::setID()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:38:15 +0200 by phpDocumentor 1.4.3