Documentation

FWLanguage
in package

Framework language

Use \Cx\Core\Locale instead

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Cloudrexx Development Team info@cloudrexx.com

version
2.3.0
subpackage

lib_framework

Table of Contents

Properties

$arrBackendLanguages  : array<string|int, mixed>
Array containing the active backend languages
$arrFrontendLanguages  : array<string|int, mixed>
Array containing the active frontend languages
$defaultBackendLangId  : int
ID of the default backend language
$defaultFrontendLangId  : int
ID of the default frontend language

Methods

getActiveBackendLanguages()  : array<string|int, mixed>
Return only the languages active in the backend
getActiveFrontendLanguages()  : array<string|int, mixed>
Return only the languages active in the frontend
getBackendLanguageArray()  : array<string|int, mixed>
Returns the complete backend language data
getBackendLanguageCodeById()  : mixed
Return the language code from the database for the given backend language ID
getBackendLanguageIdByCode()  : int
Return the backend language ID for the given code
getBackendLanguageParameter()  : mixed
Returns single backend language related fields
getDefaultBackendLangId()  : int
Returns the ID of the default backend language
getDefaultLangId()  : int
Returns the ID of the default frontend language
getFallbackLanguageArray()  : array<string|int, mixed>
Builds an array mapping frontend language ids to fallback language ids.
getFallbackLanguageIdById()  : int
Return the fallback language ID for the given frontend language ID
getFrontendIdByLocale()  : string|null
Return the ID of the given locale
getIdArray()  : array<string|int, mixed>
Returns an array of active language IDs
getIso_639_1_ofLanguageById()  : string
Get the ISO 639-1 code of an installed language identified by ID $langId. $langId will either be matched to a frontend or backend language, based on the current mode ({@see \Cx\Core\Core\Controller\Cx::isBackend()}).
getLangIdByIso639_1()  : mixed
This method is no longer used, except for old Widgets.
getLanguageArray()  : array<string|int, mixed>
Returns the complete frontend language data
getLanguageCodeById()  : mixed
Return the language code from the database for the given frontend language ID
getLanguageIdByCode()  : int
Return the frontend language ID for the given code
getLanguageParameter()  : mixed
Returns single frontend language related fields
getLocaleByFrontendId()  : string|null
Return the locale for the given Language ID
getMenu()  : string
Returns HTML code to display a language selection dropdown menu.
getMenuActiveOnly()  : string
Returns HTML code to display a language selection dropdown menu for the active frontend languages only.
getMenuoptions()  : string
Returns HTML code for the language menu options
getNameArray()  : array<string|int, mixed>
Returns an array of active language names, indexed by language ID
init()  : mixed
Loads the language config from the database

Properties

$arrBackendLanguages

Array containing the active backend languages

protected static array<string|int, mixed> $arrBackendLanguages

$arrFrontendLanguages

Array containing the active frontend languages

protected static array<string|int, mixed> $arrFrontendLanguages

$defaultBackendLangId

ID of the default backend language

protected static int $defaultBackendLangId
Tags
access

protected

$defaultFrontendLangId

ID of the default frontend language

protected static int $defaultFrontendLangId
Tags
access

protected

Methods

getActiveBackendLanguages()

Return only the languages active in the backend

public static getActiveBackendLanguages() : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

array( array( 'id' => {lang_id}, 'lang' => {iso_639-1}, 'name' => {name}, 'themesid' => {theme_id}, 'frontend' => {bool}, 'backend' => {bool}, 'is_default' => {bool}, 'fallback' => {language_id}, ) )

getActiveFrontendLanguages()

Return only the languages active in the frontend

public static getActiveFrontendLanguages() : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

array( array( 'id' => {lang_id}, 'lang' => {iso_639-1}, 'name' => {name}, 'themesid' => {theme_id}, 'frontend' => {bool}, 'backend' => {bool}, 'is_default' => {bool}, 'fallback' => {language_id}, ) )

getBackendLanguageArray()

Returns the complete backend language data

public static getBackendLanguageArray() : array<string|int, mixed>
Tags
see
FWLanguage()
access

public

Return values
array<string|int, mixed>

The language data

getBackendLanguageCodeById()

Return the language code from the database for the given backend language ID

public static getBackendLanguageCodeById(int $langId) : mixed

Returns false on failure, or if the ID is invalid

Parameters
$langId : int

The frontend language ID

Tags
static
Return values
mixed

The two letter code, or false

getBackendLanguageIdByCode()

Return the backend language ID for the given code

public static getBackendLanguageIdByCode(mixed $code) : int

Returns false on failure, or if the code is unknown

Parameters
$code : mixed
Tags
static
Return values
int

$langId The language ID, or false

getBackendLanguageParameter()

Returns single backend language related fields

public static getBackendLanguageParameter(mixed $id, mixed $index) : mixed

Access language data by specifying the language ID and the index as initialized by .

Parameters
$id : mixed
$index : mixed
Tags
access

public

Return values
mixed

Language data field content

getDefaultBackendLangId()

Returns the ID of the default backend language

public static getDefaultBackendLangId() : int
Return values
int

Language ID

getDefaultLangId()

Returns the ID of the default frontend language

public static getDefaultLangId() : int
Return values
int

Language ID

getFallbackLanguageArray()

Builds an array mapping frontend language ids to fallback language ids.

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

( language id => fallback language id )

getFallbackLanguageIdById()

Return the fallback language ID for the given frontend language ID

public static getFallbackLanguageIdById(int $langId) : int

Returns false on failure, or if the ID is invalid

Parameters
$langId : int

The language ID

Tags
static
Return values
int

$langId The language ID, or false

getFrontendIdByLocale()

Return the ID of the given locale

public static getFrontendIdByLocale(string $locale) : string|null

If no matching locale is found, returns the ID matching the two-letter language ISO code. Returns null if that isn't found either.

Parameters
$locale : string

The locale

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
string|null

The Language ID

getIdArray()

Returns an array of active language IDs

public static getIdArray([string $mode = 'frontend' ]) : array<string|int, mixed>

Note that the array returned contains the language ID both as key and value, for your convenience.

Parameters
$mode : string = 'frontend'

'frontend' or 'backend' languages. Defaults to 'frontend'

Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
array<string|int, mixed>

The array of enabled language IDs

getIso_639_1_ofLanguageById()

Get the ISO 639-1 code of an installed language identified by ID $langId. $langId will either be matched to a frontend or backend language, based on the current mode ({@see \Cx\Core\Core\Controller\Cx::isBackend()}).

public static getIso_639_1_ofLanguageById([int $langId = 0 ]) : string
Parameters
$langId : int = 0

ID of language to fetch the ISO 639-1 code

Return values
string

ISO 639-1 code or empty if not found

getLangIdByIso639_1()

This method is no longer used, except for old Widgets.

public static getLangIdByIso639_1(mixed $langCode) : mixed

Please note that this method does not do what it's name suggests, instead it's a simple wrapper for LocaleRepository::findOneByCode()

Parameters
$langCode : mixed
Tags
todo:

Drop this method as soon as no old Widgets are live and no 3rd-party apps rely on it

author

Michael Ritter michael.ritter@cloudrexx.com

getLanguageArray()

Returns the complete frontend language data

public static getLanguageArray() : array<string|int, mixed>
Tags
see
FWLanguage()
access

public

Return values
array<string|int, mixed>

The language data

getLanguageCodeById()

Return the language code from the database for the given frontend language ID

public static getLanguageCodeById(int $langId) : mixed

Returns false on failure, or if the ID is invalid

Parameters
$langId : int

The frontend language ID

Tags
static
Return values
mixed

The two letter code, or false

getLanguageIdByCode()

Return the frontend language ID for the given code

public static getLanguageIdByCode(mixed $code) : int

Returns false on failure, or if the code is unknown

Parameters
$code : mixed
Tags
static
Return values
int

$langId The language ID, or false

getLanguageParameter()

Returns single frontend language related fields

public static getLanguageParameter(mixed $id, mixed $index) : mixed

Access language data by specifying the language ID and the index as initialized by .

Parameters
$id : mixed
$index : mixed
Tags
access

public

Return values
mixed

Language data field content

getLocaleByFrontendId()

Return the locale for the given Language ID

public static getLocaleByFrontendId(int $langId) : string|null

If no proper locale is found, returns the two-letter Language ISO code. Returns null if that isn't found either.

Parameters
$langId : int

The Language ID

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
string|null

The locale, Language code, or null

getMenu()

Returns HTML code to display a language selection dropdown menu.

public static getMenu([int $selectedId = 0 ][, string $menuName = '' ][, string $onchange = '' ]) : string

Does only contain the tag pair if the optional $menuName is specified and evaluates to a true value. Frontend use only.

Parameters
$selectedId : int = 0

The optional preselected language ID

$menuName : string = ''

The optional menu name

$onchange : string = ''

The optional onchange code

Tags
author

Reto Kohli reto.kohli@comvation.com

todo

Use the Html class instead

Return values
string

The dropdown menu HTML code

getMenuoptions()

Returns HTML code for the language menu options

public static getMenuoptions([int $selectedId = 0 ][, bool $flagInactive = false ]) : string
Parameters
$selectedId : int = 0

The optional preselected language ID

$flagInactive : bool = false

If true, all languages are added, only the active ones otherwise

Tags
author

Reto Kohli reto.kohli@comvation.com

todo

Use the Html class instead

Return values
string

The menu options HTML code

getNameArray()

Returns an array of active language names, indexed by language ID

public static getNameArray([string $mode = 'frontend' ]) : array<string|int, mixed>
Parameters
$mode : string = 'frontend'

'frontend' or 'backend' languages. Defaults to 'frontend'

Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
array<string|int, mixed>

The array of enabled language names

init()

Loads the language config from the database

public static init() : mixed

This used to be in __construct but is also called from core/language.class.php to reload the config, so core/settings.class.php can rewrite .htaccess (virtual lang dirs).


        
On this page

Search results