PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TGlobalization

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.

TComponent
Extended by TApplicationComponent
Extended by TModule implements IModule
Extended by TGlobalization

Direct known subclasses

TGlobalizationAutoDetect
Package: System\I18N
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo<weizhuo[at]gmail[dot]com>
Version: $Revision: 1.66 $ $Date: ${DATE} ${TIME} $
Since: 3.0
Located at I18N/TGlobalization.php
Methods summary
public
# init( mixed $config )

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.

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.

Parameters

$config
mixed
application configuration

Overrides

TModule::init()
public string
# getTranslateDefaultCulture( )

Returns

string
default culture
public
# setTranslateDefaultCulture( boolean $value )

Parameters

$value
boolean
default culture, e.g. en_US for American English
public string
# getDefaultCulture( )

Returns

string
default culture
public
# setDefaultCulture( string $culture )

Parameters

$culture
string
default culture, e.g. en_US for American English
public string
# getDefaultCharset( )

Returns

string
default charset set
public
# setDefaultCharset( string $charset )

Parameters

$charset
string
default localization charset, e.g. UTF-8
public string
# getCulture( )

Returns

string
current application culture
public
# setCulture( string $culture )

Parameters

$culture
string
culture, e.g. en_US for American English
public string
# getCharset( )

Returns

string
localization charset
public
# setCharset( string $charset )

Parameters

$charset
string
localization charset, e.g. UTF-8
public TMap
# getTranslationConfiguration( )

Returns

TMap
translation source configuration.
protected
# setTranslationConfiguration( TMap|array $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.

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.

Parameters

$config
TMap|array
configuration options
public string
# getTranslationCatalogue( )

Returns

string
current translation catalogue.
public
# setTranslationCatalogue( string $value )

Parameters

$value
string
update the translation catalogue.
public array
# getCultureVariants( string $culture = null )

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

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

Parameters

$culture
string
$culture the Culture string

Returns

array
variants of the culture.
public array
# getLocalizedResource( string $file, string $culture = null )

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.

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.

Parameters

$file
string
filename
$culture
string
culture string, null to use current culture

Returns

array
list of possible localized resource files.
Methods inherited from TModule
getID(), setID()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __construct(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO