class I18n

Language Tools

Properties

$language
$culture
$locale
string $timezone
$locale_set

Last locale that has been set

$conventions
$template_vars
string $last_template_loaded_from

after load_template is called, you can get the location, the template is loaded from via this property

string $last_template_is_custom

after load_template is called, you can get if the template is a custum template or not

Methods

bool
check_i18n_support(bool $force = false)

No description

void
clear_message_vars()

Clear Message Vars

string
convert_i18n_sql(string $sql)

Converts given SQL containing i18n fields with user specific user language fields Example: SELECT name_i18n FROM test is converted to SELECT name_DE_DE as name_i18n FROM test Example2: SELECT name_i18n AS name FROM test is converted to SELECT name_DE_DE AS name FROM test

int
getCurrentTranslationVersion()

Return the current translation version

array
getLocaleConv()

Mimics localeconv() using Intl Library

string
getTranslation(string $token, array $placeholders = [], string $domain = 'default')

Translates a token and replaces the placeholders in it.

array
get_available_languages(bool $with_captions = false, bool $show_only_active = true, $show_only_published = true)

gets languages found in tbl|system_i18n_language.

array|string
get_conventions(bool|string $param = false)

Returns the conventions of the current locale

array
get_country_list(string $key = 'iCountryCode', string $value = 'cCountryName', $translateValue = false)

querys tbl|system_lib_country and returns array with list of countries.

string
get_culture()

No description

string
get_language()

No description

string|null
get_language_select()

Get language selection menu

string
get_locale()

No description

string
get_parsed_message(string $template_name, string $section, string $module = 'system')

No description

mixed|string
get_timezone(bool $pretty = true)

No description

array
get_translated_tokens()

Returns an array with all translated tokens during this page call

string
get_translation(string $token, string $domain = 'default')

Returns the translation for the passed token.

init()

No description

bool
isJsonToken(string $token)

Returns true if the passed token seems to be in the new JSON token format / technical token (e.g. "xelos.token.dialog.error.label")

list_timezones()

Generates an array of all timezones, using their identifier as the key and including their offset in the label

string
load_template(string $template_file, bool|string $language = false, bool|string $culture = false, bool $custom_allowed = true)

No description

array
make_i18n_lookup_array(mixed $array)

Creates an i18n lookup array containing mappings from tokens to translations

save_template(mixed $module, mixed $template_filename, mixed $template_content, mixed $language = false, mixed $culture = false, bool $custom = false, bool $is_vars_template = false)

saves a template to db different language and kulture has to be set by i18n->set_languag and i18n->set_culture custom is as default false

set_language(bool|string $locale = false)

No description

bool
set_message_vars(mixed $values)

No description

set_timezone(bool|string $timezone = false)

No description

string_to_number($string)

No description

Details

at line 96
bool check_i18n_support(bool $force = false)

No description

Parameters

bool $force

Force Check, otherwise we only check if i18n seems not supported

Return Value

bool

at line 552
void clear_message_vars()

Clear Message Vars

Return Value

void

at line 998
string convert_i18n_sql(string $sql)

Converts given SQL containing i18n fields with user specific user language fields Example: SELECT name_i18n FROM test is converted to SELECT name_DE_DE as name_i18n FROM test Example2: SELECT name_i18n AS name FROM test is converted to SELECT name_DE_DE AS name FROM test

Parameters

string $sql

Return Value

string

at line 1151
int getCurrentTranslationVersion()

Return the current translation version

Return Value

int

at line 311
array getLocaleConv()

Mimics localeconv() using Intl Library

Return Value

array

at line 643
string getTranslation(string $token, array $placeholders = [], string $domain = 'default')

Translates a token and replaces the placeholders in it.

Parameters

string $token
array $placeholders
string $domain

Return Value

string

at line 908
array get_available_languages(bool $with_captions = false, bool $show_only_active = true, $show_only_published = true)

gets languages found in tbl|system_i18n_language.

concats language and culture. i.e.: DE_DE, EN_GB

Parameters

bool $with_captions

Show Captions

bool $show_only_active

Show only active

$show_only_published

Return Value

array

$languages (i.e. array( []=>'DE_DE', []=>'EN_GB'))

at line 349
array|string get_conventions(bool|string $param = false)

Returns the conventions of the current locale

See php localeconv() for return values http://de2.php.net/manual/de/function.localeconv.php

Parameters

bool|string $param

Value to return, e.g 'decimal_point', 'thousands_sep'

Return Value

array|string

at line 965
array get_country_list(string $key = 'iCountryCode', string $value = 'cCountryName', $translateValue = false)

querys tbl|system_lib_country and returns array with list of countries.

Valid parameter values: iCountryCode cCountryName Array will be mapped with given parameters for $key and $value

Parameters

string $key
string $value
$translateValue

Return Value

array $countries

at line 335
string get_culture()

No description

Return Value

string Locale

at line 327
string get_language()

No description

Return Value

string Locale

at line 1114
string|null get_language_select()

Get language selection menu

Return Value

string|null

at line 303
string get_locale()

No description

Return Value

string Locale

at line 563
string get_parsed_message(string $template_name, string $section, string $module = 'system')

No description

Parameters

string $template_name

name of the vars file

string $section

section to return

string $module

module name or system

Return Value

string

parsed section

at line 363
mixed|string get_timezone(bool $pretty = true)

No description

Parameters

bool $pretty

Show space instead of underscore. Set false for DateTimeZone objects

Return Value

mixed|string

at line 489
array get_translated_tokens()

Returns an array with all translated tokens during this page call

Return Value

array

at line 378
string get_translation(string $token, string $domain = 'default')

Returns the translation for the passed token.

Optionally define domain to search in passed domain first. If token is not translated in passed domain the default domain will be used.

Parameters

string $token
string $domain

Return Value

string

at line 87
init()

No description

at line 434
bool isJsonToken(string $token)

Returns true if the passed token seems to be in the new JSON token format / technical token (e.g. "xelos.token.dialog.error.label")

Parameters

string $token

Return Value

bool

at line 258
list_timezones()

Generates an array of all timezones, using their identifier as the key and including their offset in the label

at line 680
string load_template(string $template_file, bool|string $language = false, bool|string $culture = false, bool $custom_allowed = true)

No description

Parameters

string $template_file

path to the template

bool|string $language

forced language

bool|string $culture

forced culture

bool $custom_allowed

custom templates are allowed to load

Return Value

string

content of the template

at line 1101
array make_i18n_lookup_array(mixed $array)

Creates an i18n lookup array containing mappings from tokens to translations

Parameters

mixed $array

An array of tokens

Return Value

array

An array of token => translation mappings

at line 809
save_template(mixed $module, mixed $template_filename, mixed $template_content, mixed $language = false, mixed $culture = false, bool $custom = false, bool $is_vars_template = false)

saves a template to db different language and kulture has to be set by i18n->set_languag and i18n->set_culture custom is as default false

Parameters

mixed $module
mixed $template_filename
mixed $template_content
mixed $language
mixed $culture
bool $custom
bool $is_vars_template

at line 118
set_language(bool|string $locale = false)

No description

Parameters

bool|string $locale

language_culture (e.g. de_DE)

at line 525
bool set_message_vars(mixed $values)

No description

Parameters

mixed $values values

Return Value

bool

false if no method was found to assign

at line 223
set_timezone(bool|string $timezone = false)

No description

Parameters

bool|string $timezone

ID of Timezone (e.g. European/Berlin)

at line 496
string_to_number($string)

No description

Parameters

$string