Class \Prado\I18N\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.
Class hierarchy
- \Prado\I18N\TGlobalization
- \Prado\TModule implements IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
|
public
|
getCultureVariants([string $culture = null ]) : array<string|int, mixed>
Gets all the variants of a specific culture. If the parameter
$culture is null, the current culture is used.
|
public
|
|
public
|
|
public
|
getIsCultureRTL([mixed $culture = null ]) : bool
This returns whether or not the current culture or the specified
culture is right to left orientation. Default $culture is null, which
equal to using $this->Culture as the parameter.
|
public
|
getLocalizedResource(string $file[, string $culture = null ]) : array<string|int, mixed>
Returns a list of possible localized files. Example
```php
$files = $app->getLocalizedResource("path/to/Home.page","en_US");
```
will return
<pre>
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'
</pre>
Note that you still need to verify the existance of these files.
|
public
|
|
public
|
|
public
|
|
public
|
init(mixed $config) : mixed
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. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
setTranslationConfiguration(array<string|int, mixed>|TMap $config) : mixed
Sets the translation configuration. Example configuration:
```php
$config['type'] = 'XLIFF'; //XLIFF, gettext, PHP or Database
$config['source'] = 'Path\to\directory'; // for types XLIFF, PHP and gettext
$config['source'] = 'connectionId'; // for type Database
$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.
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |