Contentserv PHP API

CSLanguage
in package

This class is the API to operate on the CONTENTSERV language model.

Tags
access

public

since
5.0

Table of Contents

createLanguage()  : CSLanguage
Creates a new CSLanguage
delete()  : mixed
Deletes the language
getAvailableInterfaceLanguageIds()  : array<string|int, mixed>
Returns all available language interface IDs
getAvailableInterfaceLanguageNames()  : array<string|int, mixed>
Returns the names of the all available interface languages.
getAvailableInterfaceLanguages()  : array<string|int, CSLanguage>
Returns an array of language objects, which are available and interface languages.
getAvailableLanguageIDs()  : array<string|int, mixed>
Returns all available language IDs
getAvailableLanguageNames()  : array<string|int, mixed>
Returns the available language full/short names based on a bool parameter.
getAvailableLanguages()  : array<string|int, CSLanguage>
Returns all available languages for a given record
getDefaultLanguage()  : CSLanguage
Loads the default language
getDictionarySuffix()  : string
Get the Dictionary suffix of the language.
getFlagHtml()  : string
Get the flag URL for this Language, taking care of converting deprecated ".gif" flags to the equivalent ".svg" vector flag, if it exits.
getFlagUrl()  : string
Get the flag URL for the current language relative to the admin/project directory, taking care of converting any reference to the deprecated ".gif" flags to the equivalent ".svg" vector flag, if it exits.
getFullName()  : string
Get the full name of the language
getID()  : int
Returns the ID of the language
getImageUrl()  : string
returns the icon path for the current language relative to the admin/project directory
getLanguage()  : CSLanguage
Loads an existing language for a given ID or short name
getLanguageFromISOCode()  : CSLanguage
Loads the language for the supplied iso code
getLanguageIdsByShortNames()  : array<string|int, mixed>
Method that converts a list of language short names into a list of numeric language ids.
getLanguageIdsByTags()  : array<string|int, mixed>
Returns an array of Language Ids for the corresponding TagIds passed as argument
getLanguageNames()  : array<string|int, mixed>
Returns the language full/short names based on a bool parameter for all configured languages.
getLanguages()  : array<string|int, CSLanguage>
Returns an array with CSLanguage matching the SQL filter condition in the given sort order.
getLanguageTags()  : array<string|int, mixed>
Returns an array of the tag ids associated to all languages
getNumberFormat()  : string
Returns the number format that has been defined for the language.
getPath()  : array<string|int, mixed>
Fetches the path of the parents in the tree structure
getRichEditorLanguage()  : string
Returns the defined language (as ShortName) for RICH Editors.
getRichEditorLanguages()  : array<string|int, mixed>
getShortName()  : string
Get the short name of the language
getSpellCheckerLang()  : string
Get the Spell Checker Language
getTechnicalLanguage()  : CSLanguage
Loads the English UK or US language.
getUILanguage()  : CSLanguage
Returns the current UI Language
getValue()  : string
Gets a value of the Language
isAvailable()  : bool
Get whether the language is available or not
isDefault()  : bool
Get whether the language is the default language or not
isInterfaceLanguage()  : bool
Returns true if the language object is an interface language.
setAvailable()  : mixed
Sets whether the language is available or not
setDefault()  : mixed
Sets the current language as default language
setFullName()  : mixed
Set the full name of the language
setInterfaceLanguage()  : mixed
Sets the boolean flag if the language should be an interface language.
setShortName()  : mixed
Set the short name of the language
setValue()  : void
Sets a value of the Language
store()  : int
Stores the language to the database and returns the ID of the language

Methods

createLanguage()

Creates a new CSLanguage

public static createLanguage(string $shortName, string $fullName[, string $flagUrl = null ][, string $dictionarySuffix = 'en' ]) : CSLanguage
Parameters
$shortName : string

the short name of the language

$fullName : string

the full name of the language

$flagUrl : string = null

of the language

$dictionarySuffix : string = 'en'

the dictionary suffix

Tags
access

public

Return values
CSLanguage

the new language

delete()

Deletes the language

public delete() : mixed
Tags
access

public

Return values
mixed

getAvailableInterfaceLanguageIds()

Returns all available language interface IDs

public static getAvailableInterfaceLanguageIds() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

an array of language ids.

getAvailableInterfaceLanguageNames()

Returns the names of the all available interface languages.

public static getAvailableInterfaceLanguageNames([bool $bReturnShortName = false ]) : array<string|int, mixed>
Parameters
$bReturnShortName : bool = false

Whether the shortname or the fullname should be returned.

Tags
Return values
array<string|int, mixed>

with the short or full names of the all available interface languages.

getAvailableInterfaceLanguages()

Returns an array of language objects, which are available and interface languages.

public static getAvailableInterfaceLanguages() : array<string|int, CSLanguage>
Tags
Return values
array<string|int, CSLanguage>

An arry of language objects.

getAvailableLanguageIDs()

Returns all available language IDs

public static getAvailableLanguageIDs() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

an array of LanguageID

getAvailableLanguageNames()

Returns the available language full/short names based on a bool parameter.

public static getAvailableLanguageNames([bool $bReturnShortNames = false ]) : array<string|int, mixed>
Parameters
$bReturnShortNames : bool = false

Optional parameter, when true, it returns the short name.

Tags
Return values
array<string|int, mixed>

getAvailableLanguages()

Returns all available languages for a given record

public static getAvailableLanguages([Record $record = null ]) : array<string|int, CSLanguage>
Parameters
$record : Record = null

any record to check the language rights of the user too. If null is passed all languages defined in the backend as available are returned.

Tags
access

public

Return values
array<string|int, CSLanguage>

array of language objects

getDefaultLanguage()

Loads the default language

public static getDefaultLanguage() : CSLanguage
Tags
access

public

Return values
CSLanguage

a CSLanguage object which represents the default language

getDictionarySuffix()

Get the Dictionary suffix of the language.

public getDictionarySuffix() : string
Tags
Return values
string

getFlagHtml()

Get the flag URL for this Language, taking care of converting deprecated ".gif" flags to the equivalent ".svg" vector flag, if it exits.

public getFlagHtml() : string
Tags
Return values
string

getFlagUrl()

Get the flag URL for the current language relative to the admin/project directory, taking care of converting any reference to the deprecated ".gif" flags to the equivalent ".svg" vector flag, if it exits.

public getFlagUrl() : string
Tags
Return values
string

getFullName()

Get the full name of the language

public getFullName() : string
Tags
access

public

Return values
string

$newName the new name of the language

getID()

Returns the ID of the language

public getID() : int
Tags
access

public

Return values
int

the ID of the language

getImageUrl()

returns the icon path for the current language relative to the admin/project directory

public getImageUrl() : string
Tags
access

public

deprecated

Deprecated since CS21.5, use CSLanguage::getFlagUrl() instead.

Return values
string

the path of the current language icon

getLanguage()

Loads an existing language for a given ID or short name

public static getLanguage([mixed $language = NULL ]) : CSLanguage
Parameters
$language : mixed = NULL

Either an int as id or a string as short name of the requested language

Tags
access

public

Return values
CSLanguage

a CSLanguage object for the given ID

getLanguageFromISOCode()

Loads the language for the supplied iso code

public static getLanguageFromISOCode(mixed $isoCode) : CSLanguage
Parameters
$isoCode : mixed
Tags
access

public

Return values
CSLanguage

a CSLanguage object which represents the language

getLanguageIdsByShortNames()

Method that converts a list of language short names into a list of numeric language ids.

public static getLanguageIdsByShortNames(mixed $aShortNames) : array<string|int, mixed>
Parameters
$aShortNames : mixed

array

Tags
Return values
array<string|int, mixed>

getLanguageIdsByTags()

Returns an array of Language Ids for the corresponding TagIds passed as argument

public static getLanguageIdsByTags(mixed $aTagIds) : array<string|int, mixed>
Parameters
$aTagIds : mixed

array The tags ids to get the matching language ids for

Tags
Return values
array<string|int, mixed>

The matching language ids for the given tags

getLanguageNames()

Returns the language full/short names based on a bool parameter for all configured languages.

public static getLanguageNames([bool $bReturnShortNames = false ][, bool $bReturnDisabledFlag = false ]) : array<string|int, mixed>
Parameters
$bReturnShortNames : bool = false

The parameter defines if the languages are returned with the short names or full names.

$bReturnDisabledFlag : bool = false

The parameter defines if the info "(Disabled)" will be added to the language name.

Tags
Return values
array<string|int, mixed>

getLanguages()

Returns an array with CSLanguage matching the SQL filter condition in the given sort order.

public static getLanguages([string $filter = '1=1' ][, string $sortorder = '' ]) : array<string|int, CSLanguage>
Parameters
$filter : string = '1=1'

SQL Filter condition.

$sortorder : string = ''

SQL Sort Order

Tags
access

public

Return values
array<string|int, CSLanguage>

array with the CSLanguage objects

getLanguageTags()

Returns an array of the tag ids associated to all languages

public static getLanguageTags() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

The array of unique tag ids

getNumberFormat()

Returns the number format that has been defined for the language.

public getNumberFormat() : string

If no format has been defined, the simple American format (####.##) is used.

Tags
access

public

Return values
string

The selected number format.

getPath()

Fetches the path of the parents in the tree structure

public getPath() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getRichEditorLanguage()

Returns the defined language (as ShortName) for RICH Editors.

public getRichEditorLanguage() : string
Tags
Return values
string

getRichEditorLanguages()

public static getRichEditorLanguages([string $sType = '' ]) : array<string|int, mixed>
Parameters
$sType : string = ''
Tags
Return values
array<string|int, mixed>

getShortName()

Get the short name of the language

public getShortName() : string
Tags
access

public

Return values
string

$newName the new short name of the language

getSpellCheckerLang()

Get the Spell Checker Language

public getSpellCheckerLang() : string
Tags
Return values
string

getTechnicalLanguage()

Loads the English UK or US language.

public static getTechnicalLanguage() : CSLanguage
Tags
access

public

Return values
CSLanguage

a CSLanguage object which represents the language

getUILanguage()

Returns the current UI Language

public static getUILanguage() : CSLanguage
Tags
access

public

Return values
CSLanguage

a CSLanguage object

getValue()

Gets a value of the Language

public getValue(string $identifier) : string
Parameters
$identifier : string

field of the value to get

Tags
access

public

Return values
string

the value

isAvailable()

Get whether the language is available or not

public isAvailable() : bool
Tags
access

public

Return values
bool

whether the language is available

isDefault()

Get whether the language is the default language or not

public isDefault() : bool
Tags
access

public

Return values
bool

whether the language is the default language

isInterfaceLanguage()

Returns true if the language object is an interface language.

public isInterfaceLanguage() : bool
Tags
Return values
bool

setAvailable()

Sets whether the language is available or not

public setAvailable([mixed $isAvailable = true ]) : mixed
Parameters
$isAvailable : mixed = true
Tags
access

public

Return values
mixed

setDefault()

Sets the current language as default language

public setDefault() : mixed
Tags
access

public

Return values
mixed

setFullName()

Set the full name of the language

public setFullName(string $newName) : mixed
Parameters
$newName : string

the new name of the language

Tags
access

public

Return values
mixed

setInterfaceLanguage()

Sets the boolean flag if the language should be an interface language.

public setInterfaceLanguage(bool $bIsInterfaceLanguage) : mixed
Parameters
$bIsInterfaceLanguage : bool

If the language should be an interface language.

Tags
Return values
mixed

setShortName()

Set the short name of the language

public setShortName(string $newName) : mixed
Parameters
$newName : string

the new short name of the language

Tags
access

public

Return values
mixed

setValue()

Sets a value of the Language

public setValue(string $identifier, string $value) : void
Parameters
$identifier : string

field of the value to set

$value : string

value to set

Tags
access

public

Return values
void

store()

Stores the language to the database and returns the ID of the language

public store() : int
Tags
access

public

Return values
int

the ID of the language


        

Search results