Documentation

CoreLocalization
in package

$this->core->localization Class to manage localizations

Table of Contents

Properties

$api_creation_credentials  : mixed
$api_lang  : mixed
$api_namespace  : mixed
$api_service  : mixed
$api_user  : mixed
$auto_reset  : mixed
$cacheExpiration  : mixed
$data  : mixed
$error  : mixed
$errorMsg  : mixed
$localize_files  : mixed
$reset  : mixed
$reset_files  : mixed
$core  : mixed
$init  : mixed

Methods

__construct()  : mixed
addError()  : mixed
changeArrayWithTags()  : mixed
Apply localizations over $array with tags included
changeTextWithTags()  : mixed|string
Return localizations taking $text with tags included
createTags()  : array<string|int, mixed>|void
Get a Localization code from a localization file
deleteLocalizationsCache()  : mixed
Delete cache Data in $namespace
getAppCats()  : mixed|string
Get a Localization code from a localization file
getCode()  : mixed
getDefaultCreationLang()  : string
Get the current default lang for tags creation
getDefaultLang()  : string
Get the current default lang for localizations
getTag()  : mixed|string
Get a Localization code from a localization file If the tag is not found and $this->auto_reset is true it will try to load the dictionary agaain.
initLocalizationService()  : mixed
Se external API to feed localization tags
readLocalizationData()  : mixed
resetLocalizationsCache()  : mixed
Reset Cache for localizations. Every call to localizations will call API at least once
setCode()  : mixed
setCreationCredentials()  : mixed
Set credentials to create tags in the ERP
setDefaultCreationToConvertLangs()  : mixed
Set default langs to convert on tags creation
setDefaultLang()  : mixed
Set default lang for localizations
setDefaultNamespace()  : mixed
Set default namespace for localizations
setTag()  : mixed|string
Get a Localization code from a localization file

Properties

$api_creation_credentials

public mixed $api_creation_credentials = []

$api_lang

public mixed $api_lang = 'en'

$api_namespace

public mixed $api_namespace = 'cloudframework'

$api_service

public mixed $api_service = \null

$api_user

public mixed $api_user = 'user-unknown'

$auto_reset

public mixed $auto_reset = \false

$cacheExpiration

public mixed $cacheExpiration = -1

$data

public mixed $data = []

$error

public mixed $error = \false

$errorMsg

public mixed $errorMsg = []

$localize_files

public mixed $localize_files = \null

$reset

public mixed $reset = \false

$reset_files

public mixed $reset_files = []

$core

protected mixed $core

$init

private mixed $init = \false

Methods

__construct()

public __construct(Core7 &$core) : mixed
Parameters
$core : Core7

addError()

public addError(mixed $value) : mixed
Parameters
$value : mixed

changeArrayWithTags()

Apply localizations over $array with tags included

public changeArrayWithTags(array<string|int, mixed> &$array[, string $lang = '' ][, string $namespace = '' ]) : mixed
Parameters
$array : array<string|int, mixed>
$lang : string = ''
$namespace : string = ''

[optional]

changeTextWithTags()

Return localizations taking $text with tags included

public changeTextWithTags(string &$text[, string $lang = '' ][, string $namespace = '' ]) : mixed|string
Parameters
$text : string
$lang : string = ''
$namespace : string = ''

[optional]

Return values
mixed|string

createTags()

Get a Localization code from a localization file

public createTags(string $tag, array<string|int, mixed> $values[, bool $with_subtags = false ][, string $namespace = '' ]) : array<string|int, mixed>|void
Parameters
$tag : string

the tag to translate with the pattern [{][$namepace:,]<app_id>;<cat_id>;<tag_id>[;<subtag_id>][}]

$values : array<string|int, mixed>
$with_subtags : bool = false
$namespace : string = ''

[optional]

Return values
array<string|int, mixed>|void

deleteLocalizationsCache()

Delete cache Data in $namespace

public deleteLocalizationsCache([string $loc_file = '' ][, string $namespace = '' ]) : mixed
Parameters
$loc_file : string = ''

optional. Specifical the loc_file (ex: '<app_id>;<cat_id>')

$namespace : string = ''

optional. Default $this->api_namespace

getAppCats()

Get a Localization code from a localization file

public getAppCats([string $lang = '' ][, string $namespace = '' ]) : mixed|string
Parameters
$lang : string = ''
$namespace : string = ''

[optional]

Return values
mixed|string

getCode()

public getCode(string $code[, string $lang = '' ][, mixed $namespace = '' ]) : mixed
Parameters
$code : string
$lang : string = ''
$namespace : mixed = ''
Tags
deprecated

Use getTag

getDefaultCreationLang()

Get the current default lang for tags creation

public getDefaultCreationLang() : string
Return values
string

getDefaultLang()

Get the current default lang for localizations

public getDefaultLang() : string
Return values
string

getTag()

Get a Localization code from a localization file If the tag is not found and $this->auto_reset is true it will try to load the dictionary agaain.

public getTag(string $tag[, string $lang = '' ][, string $namespace = '' ]) : mixed|string
Parameters
$tag : string

the tag to translate with the pattern [{][$namepace:,]<app_id>;<cat_id>;<tag_id>[;<subtag_id>][}]

$lang : string = ''
$namespace : string = ''

[optional]

Return values
mixed|string

initLocalizationService()

Se external API to feed localization tags

public initLocalizationService([string $namespace = 'cloudframework' ][, mixed $lang = 'en' ][, string $user = null ][, string $api = 'https://api.cloudframework.io/erp/localizations' ]) : mixed
Parameters
$namespace : string = 'cloudframework'
$lang : mixed = 'en'
$user : string = null
$api : string = 'https://api.cloudframework.io/erp/localizations'

readLocalizationData()

public readLocalizationData(string $locFile[, string $lang = '' ][, string $namespace = '' ]) : mixed
Parameters
$locFile : string
$lang : string = ''
$namespace : string = ''

resetLocalizationsCache()

Reset Cache for localizations. Every call to localizations will call API at least once

public resetLocalizationsCache() : mixed

setCode()

public setCode(string $code, string $value[, string $lang = '' ][, mixed $namespace = '' ]) : mixed
Parameters
$code : string
$value : string
$lang : string = ''
$namespace : mixed = ''
Tags
deprecated

Use getTag

setCreationCredentials()

Set credentials to create tags in the ERP

public setCreationCredentials(array<string|int, mixed> $credentials) : mixed
Parameters
$credentials : array<string|int, mixed>

setDefaultCreationToConvertLangs()

Set default langs to convert on tags creation

public setDefaultCreationToConvertLangs(array<string|int, mixed> $langs) : mixed
Parameters
$langs : array<string|int, mixed>

setDefaultLang()

Set default lang for localizations

public setDefaultLang(string $lang) : mixed
Parameters
$lang : string

setDefaultNamespace()

Set default namespace for localizations

public setDefaultNamespace(string $namespace) : mixed
Parameters
$namespace : string

setTag()

Get a Localization code from a localization file

public setTag(string $tag, string $value[, string $lang = '' ][, string $namespace = '' ]) : mixed|string
Parameters
$tag : string
$value : string
$lang : string = ''
$namespace : string = ''

[optional]

Return values
mixed|string

        
On this page

Search results