Class Languages
Language management. Maintains all languages installed on the system and
allows new languages to be installed.
All language codes are in ISO 639-1 ISO 3166-1 alpha-2 concatenated format (i.e. "en_us")
-
Model
-
AppModel
uses
Blesta\Core\Util\Common\Traits\Container
-
Languages
Methods summary
public
|
#
__construct( )
Initialize Languages
Overrides
|
public
|
#
get( integer $company_id, string $code )
Fetches an installed language available to the given company
Fetches an installed language available to the given company
Parameters
- $company_id
- The ID of the company to fetch installed languages under.
- $code
- The language installed in ISO 639-1 ISO 3166-1 alpha-2 concatenated format (e.g. "en_us")
|
public
array
|
#
getAll( integer $company_id )
Fetches all languages installed at the given company
Fetches all languages installed at the given company
Parameters
- $company_id
- The ID of the company to fetch installed languages under.
Returns
array An array of stdClass objects representing languages installed under the given company.
|
public
array
|
#
getAvailable( )
Get all available languages on the file system
Get all available languages on the file system
Returns
array An array of key/value pairs representing languages available on the file system.
Where the key is the language code and the value is the name of the language in its native form.
|
public
|
#
add( integer $company_id, string $code )
Installs the given language file for the given company, if it exists
Installs the given language file for the given company, if it exists
Parameters
- $company_id
- The ID of the company under which the language should be installed
- $code
- The language to install in ISO 639-1 ISO 3166-1 alpha-2 concatenated format (e.g. "en_us")
|
public
|
#
delete( integer $company_id, string $code )
Uninstalls the given language
Uninstalls the given language
Parameters
- $company_id
- The ID of the company to uninstall the given language from
- $code
- The language code under the given company to uninstall
|
public
array
|
#
getAllUninstallable( integer $company_id )
Retrieves a list of all languages that cannot be uninstalled for this company
Retrieves a list of all languages that cannot be uninstalled for this company
Parameters
- $company_id
- The ID of the company whose uninstallable languages to fetch
Returns
array A list of uninstallable languages
|
public
boolean
|
#
validateCodeExists( string $code, integer $company_id )
Validates whether or not the $code and $company_id combination already exists
Validates whether or not the $code and $company_id combination already exists
Parameters
- $code
- The ISO 639-1 ISO 3166-1 alpha-2 code in concatenated format (e.g. "en_us")
- $company_id
- The company ID
Returns
boolean True if the $code and $company_id combination already exists, false otherwise
|
public
boolean
|
#
validateDefaultLang( string $code, integer $company_id )
Validates whether or not the $code and $company_id combination are the default language, or 'en_us'
Validates whether or not the $code and $company_id combination are the default language, or 'en_us'
Parameters
- $code
- The ISO 639-1 ISO 3166-1 alpha-2 code in concatenated format (e.g. "en_us")
- $company_id
- The company ID
Returns
boolean True if the $code and $company_id are the default language or 'en_us', false otherwise
|
Methods inherited from AppModel
_(),
boolToInt(),
currencyToDecimal(),
dateToUtc(),
errors(),
getPerPage(),
ifSet(),
loadCrypto(),
setDefaultIfEmpty(),
setPerPage(),
setRulesIfSet(),
strToBool(),
systemDecrypt(),
systemEncrypt(),
systemHash(),
truncateDecimal(),
validateExists(),
validateStateCountry()
|