Метод | Описание | |
---|---|---|
getCharset ( ) : string | ||
getCulture ( ) : string | ||
getCultureVariants ( string $culture = null ) : array | Gets all the variants of a specific culture. If the parameter $culture is null, the current culture is used. | |
getDefaultCharset ( ) : string | ||
getDefaultCulture ( ) : string | ||
getLocalizedResource ( $file, $culture = null ) : array |
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. |
|
getTranslateDefaultCulture ( ) : string | ||
getTranslationCatalogue ( ) : string | ||
getTranslationConfiguration ( ) : TMap | ||
init ( $config ) | Initialize the Culture and Charset for this application. | |
setCharset ( $charset ) | ||
setCulture ( $culture ) | ||
setDefaultCharset ( $charset ) | ||
setDefaultCulture ( $culture ) | ||
setTranslateDefaultCulture ( $value ) | ||
setTranslationCatalogue ( $value ) |
Метод | Описание | |
---|---|---|
setTranslationConfiguration ( $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. |
public getCulture ( ) : string | ||
Результат | string | current application culture |
public getCultureVariants ( string $culture = null ) : array | ||
$culture | string | the Culture string |
Результат | array | variants of the culture. |
public getDefaultCharset ( ) : string | ||
Результат | string | default charset set |
public getDefaultCulture ( ) : string | ||
Результат | string | default culture |
$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.
public getLocalizedResource ( $file, $culture = null ) : array | ||
Результат | array | list of possible localized resource files. |
public getTranslateDefaultCulture ( ) : string | ||
Результат | string | default culture |
public getTranslationCatalogue ( ) : string | ||
Результат | string | current translation catalogue. |
public getTranslationConfiguration ( ) : TMap | ||
Результат | TMap | translation source configuration. |
public init ( $config ) |
$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. protected setTranslationConfiguration ( $config ) |