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

mixed
getTranslations($locale, false $domain = false, $tokenPrefix = false, $onlyCustom = false)

Retuns all translations for the passed locale and optional domain, tokenprefix

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
get_language_select(array $linkParams = [])

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

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 91
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 524
void clear_message_vars()

Clear Message Vars

Return Value

void

at line 941
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 441
mixed getTranslations($locale, false $domain = false, $tokenPrefix = false, $onlyCustom = false)

Retuns all translations for the passed locale and optional domain, tokenprefix

Parameters

$locale
false $domain
$tokenPrefix
$onlyCustom

Return Value

mixed

at line 851
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 321
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 908
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 307
string get_culture()

No description

Return Value

string

Locale

at line 299
string get_language()

No description

Return Value

string

Locale

at line 1059
string get_language_select(array $linkParams = [])

Get language selection menu

Parameters

array $linkParams

['label'=>'Please select language', 'class'=>'btn'] You can provide optional params for the select link

Return Value

string

at line 291
string get_locale()

No description

Return Value

string

Locale

at line 535
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 335
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 461
array get_translated_tokens()

Returns an array with all translated tokens during this page call

Return Value

array

at line 349
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 82
init()

No description

at line 246
list_timezones()

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

at line 631
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 1044
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 752
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 113
set_language(bool|string $locale = false)

No description

Parameters

bool|string $locale

language_culture (e.g. de_DE)

at line 497
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 211
set_timezone(bool|string $timezone = false)

No description

Parameters

bool|string $timezone

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

at line 468
string_to_number($string)

No description

Parameters

$string