System
[ class tree: System ] [ index: System ] [ all elements ]

Class: TGlobalization

Source Location: /TGlobalization.php

Class Overview


TGlobalization class

Class Details

[line 40]
TGlobalization class

By default, TGlobalization is used by the PRADO framework to store the Culture/Locale, Charset, Translation Configuration, and Translation Cache information. You should extend to specify how the culture/locale is set.

You can specify your own globalization class in the application specification.

Namespace: System




version:  v1.0, last update on 24 Dec 2004
author:  Wei Zhuo <[at] gmail [dot] com weizhuo [at] gmail [dot] com>


[ Top ]

Variables

Methods


Child classes:

HTTPGlobalization
HTTPGlobalization class.

Class Variables

$Cache =

[line 76]

The caching directory for translations.



access:  public

Type:   string


[ Top ]

$Charset =

[line 64]

The current charset.



access:  public

Type:   string


[ Top ]

$ContentType =  'text/html'

[line 82]

The content type for the http header



access:  public

Type:   string


[ Top ]

$Culture =

[line 58]

The current culture.



access:  public

Type:   string


[ Top ]

$defaultCharset = 'UTF-8'

[line 46]

Character set, default 'UTF-8'.



access:  protected

Type:   string


[ Top ]

$defaultCulture =  'en'

[line 52]

Default culture, 'en'.



access:  protected

Type:   string


[ Top ]

$Translation =

[line 70]

The current Translation configuration.



access:  public

Type:   array


[ Top ]



Class Methods


constructor __construct [line 89]

TGlobalization __construct( mixed $config)

Constructor.

Create a new Globalization handler.




access:  public


Parameters:

mixed   $config   configuration

[ Top ]

method getDefaultCharset [line 160]

string getDefaultCharset( )

Returns the default charset.



return:  the default charset
access:  public


[ Top ]

method getDefaultCulture [line 138]

string getDefaultCulture( )

Returns the default culture.



return:  default culture.
access:  public


[ Top ]

method getVariants [line 171]

array getVariants( [string $culture = null])

Get the variant of a specific culture. If the parameter $culture is null, the current culture is used.



return:  variants of the culture.
access:  public


Parameters:

string   $culture   the Culture string

[ Top ]

method init [line 128]

void init( )

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. See the I18N example, HTTPGlobalization class for a simple example. N.BWhen override this method, be sure to set BOTH the Culture and Charset.




access:  public


Overridden in child classes as:

HTTPGlobalization::init()
Set the Culture by using the HTTPNegotiator to find the prefered language from the client browser.

[ Top ]

method sendContentTypeHeader [line 151]

void sendContentTypeHeader( )

Send the content type header.

This method should be called before sending out the content. Content type header is sent in TPage::execute, before echoing the contents. Content type and charset can be set with $this->ContentType and $this->Charset respectively.




access:  public
see:  TPage::execute()


[ Top ]


© 2004-2005 PRADO Software Group. All Rights Reserved.