## 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.

- since: 3.0
- version: $Revision: 1.66 $ $Date: ${DATE} ${TIME} $
- author: Wei Zhuo<weizhuo[at]gmail[dot]com>

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])
string getTranslationCatalogue ()
TMap getTranslationConfiguration ()
void init (TXmlElement $xml)
void setCharset (string $charset)
void setCulture (string $culture)
void setDefaultCharset (string $charset)
void setDefaultCulture (string $culture)
void setTranslationCatalogue (string $value)
void setTranslationConfiguration (TMap $config)
Methods
getCharset (line 134)

- return: localization charset
- access: public

string getCharset ()
getCulture (line 118)

- return: current application culture
- access: public

string getCulture ()
getCultureVariants (line 224)

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 102)

- return: default charset set
- access: public

string getDefaultCharset ()
getDefaultCulture (line 86)

- return: default culture
- access: public

string getDefaultCulture ()
getLocalizedResource (line 253)

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.

- 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

getTranslationCatalogue (line 205)

- return: current translation catalogue.
- access: public

string getTranslationCatalogue ()
getTranslationConfiguration (line 150)

- return: translation source configuration.
- access: public

TMap getTranslationConfiguration ()
init (line 67)

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 (TXmlElement $xml)

- TXmlElement $xml: application configuration

Redefinition of:

TModule::init()
  Initializes the module.

Redefined in descendants as:

- TGlobalizationAutoDetect::init()

setCharset (line 142)

- access: public

void setCharset (string $charset)

- string $charset: localization charset, e.g. <tt>UTF-8</tt>

setCulture (line 126)

- access: public

void setCulture (string $culture)

- string $culture: culture, e.g. <tt>en_US</tt> for American English

setDefaultCharset (line 110)

- access: public

void setDefaultCharset (string $charset)

- string $charset: default localization charset, e.g. <tt>UTF-8</tt>

setDefaultCulture (line 94)

- access: public

void setDefaultCulture (string $culture)

- string $culture: default culture, e.g. <tt>en_US</tt> for American English

setTranslationCatalogue (line 213)

- access: public

void setTranslationCatalogue (string $value)

- string $value: update the translation catalogue.

setTranslationConfiguration (line 168)

Sets the translation configuration. Example configuration:

     $config['type'] = 'XLIFF'; //XLIFF, gettext, mysql or sqlite
      $config['source'] = 'Path.to.directory'; //or database connection string
      $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.

- access: protected

void setTranslationConfiguration (TMap $config)

- TMap $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::__get()
> TComponent::__set()

Documentation generated on Sun, 30 Sep 2007 19:16:11 -0400 by phpDocumentor 1.3.0RC4