LanguageHelper

Helper class for the Language package

since

2.0.0-alpha

package

Joomla Framework

Methods

exists

Checks if a language exists.

exists(string lang, string basePath) : bool

This is a simple, quick check for the directory that should contain language files for the given user.

since

2.0.0-alpha

Arguments

lang

stringLanguage to check.

basePath

stringDirectory to check for the specified language.

Response

boolTrue if the language exists.

getKnownLanguages

Returns a list of known languages for an area

getKnownLanguages(string basePath) : array
since

2.0.0-alpha

Arguments

basePath

stringThe basepath to use

Response

arraykey/value pair with the language file and real name.

getLanguagePath

Get the path to a language

getLanguagePath(string basePath, string language = '') : string
since

2.0.0-alpha

Arguments

basePath

stringThe basepath to use.

language

stringThe language tag.

Response

stringPath to the language folder

getMetadata

Returns a associative array holding the metadata.

getMetadata(string lang, string path) : array|null
since

2.0.0-alpha

Arguments

lang

stringThe name of the language.

path

stringThe filepath to the language folder.

Response

array|nullIf $lang exists return key/value pair with the language metadata, otherwise return NULL.

parseLanguageFiles

Searches for language directories within a certain base dir.

parseLanguageFiles(string dir = '') : array
since

2.0.0-alpha

Arguments

dir

stringdirectory of files.

Response

arrayArray holding the found languages as filename => real name pairs.

parseXmlLanguageFile

Parse XML file for language information.

parseXmlLanguageFile(string path) : array|null
since

2.0.0-alpha

throws

\RuntimeException

Arguments

path

stringPath to the XML files.

Response

array|nullArray holding the found metadata as a key => value pair.