Language

Languages/translation handler class

since

1.0

package

Joomla Framework

Methods

_

Translate function, mimics the php gettext (alias _) function.

_( string,  jsSafe = false,  interpretBackSlashes = true) : 
deprecated

The function checks if $jsSafe is true, then if $interpretBackslashes is true.

see Language::translate()
since

1.0

deprecated

3.0 Use translate instead

Arguments

string

stringThe string to translate

jsSafe

boolMake the result JavaScript safe

interpretBackSlashes

boolInterpret \t and \n

Response

stringThe translation of the string

__construct

Constructor activating the default information of the language.

__construct(\Joomla\Language\ParserRegistry parserRegistry,  path,  lang = '',  debug = false) : 
since

1.0

Arguments

parserRegistry

ParserRegistryA registry containing the supported file parsers

path

stringThe base path to the language folder

lang

stringThe language

debug

boolIndicates if language debugging is enabled

Response

mixed

debugFile

Debugs a language file

debugFile( filename) : 
since

2.0

Arguments

filename

stringAbsolute path to the file to debug

Response

intA count of the number of parsing errors

exists

Checks if a language exists.

exists( lang,  basePath = '') : 
static deprecated

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

see LanguageHelper::exists()
since

1.0

deprecated

3.0 Use LanguageHelper::exists() instead

Arguments

lang

stringLanguage to check.

basePath

stringOptional path to check.

Response

boolTrue if the language exists.

get

Get a metadata language property.

get( property,  default = null) : 
since

1.0

Arguments

property

stringThe name of the property.

default

mixedThe default value.

Response

mixedThe value of the property.

getBasePath

Get the base path for the instance.

getBasePath() : 
since

2.0

Response

string

getCallerInfo

Determine who called Language or Text.

getCallerInfo() : 
since

1.0

Response

mixedCaller information or null if unavailable

getCatalogue

Get the message catalogue for the language.

getCatalogue() : \Joomla\Language\MessageCatalogue
since

2.0

Response

MessageCatalogue

getDebug

Get the Debug property.

getDebug() : 
since

1.0

Response

boolTrue is in debug mode.

getDefault

Get the default language code.

getDefault() : 
since

1.0

Response

stringLanguage code.

getErrorFiles

Get a list of language files that are in error state.

getErrorFiles() : mixed||string|int
since

1.0

Response

array<string|int, mixed>

getFirstDay

Get the first day of the week for this language.

getFirstDay() : 
since

1.0

Response

intThe first day of the week according to the language

getKnownLanguages

Returns a list of known languages for an area

getKnownLanguages( basePath = '') : mixed||string|int
static deprecated
see LanguageHelper::getKnownLanguages()
since

1.0

deprecated

3.0 Use LanguageHelper::getKnownLanguages() instead

Arguments

basePath

stringThe basepath to use

Response

array<string|int, mixed>key/value pair with the language file and real name.

getLanguage

Get the current language code.

getLanguage() : 
since

1.0

Response

stringThe language code

getLanguagePath

Get the path to a language

getLanguagePath( basePath = '',  language = '') : 
static deprecated
see LanguageHelper::getLanguagePath()
since

1.0

deprecated

3.0 Use LanguageHelper::getLanguagePath() instead

Arguments

basePath

stringThe basepath to use.

language

stringThe language tag.

Response

stringlanguage related path or null.

getLocale

Get the language locale based on current language.

getLocale() : mixed||string|int
since

1.0

Response

array<string|int, mixed>The locale according to the language.

getMetadata

Returns a associative array holding the metadata.

getMetadata( lang,  basePath) : 
static deprecated
see LanguageHelper::getMetadata()
since

1.0

deprecated

3.0 Use LanguageHelper::getMetadata() instead

Arguments

lang

stringThe name of the language.

basePath

stringThe filepath to the language folder.

Response

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

getName

Getter for Name.

getName() : 
since

1.0

Response

stringOfficial name element of the language.

getOrphans

Get the list of orphaned strings if being tracked.

getOrphans() : mixed||string|int
since

1.0

Response

array<string|int, mixed>Orphaned text.

getPaths

Get a list of language files that have been loaded.

getPaths( extension = null) : mixed||string|int
since

1.0

Arguments

extension

stringAn optional extension name.

Response

array<string|int, mixed>

getPluralSuffixes

Returns an array of suffixes for plural rules.

getPluralSuffixes( count) : string||string|int
since

1.0

Arguments

count

intThe count number the rule is for.

Response

array<string|int, string>The array of suffixes.

getTag

Getter for the language tag (as defined in RFC 3066)

getTag() : 
since

1.0

Response

stringThe language tag.

getUsed

Get the list of used strings.

getUsed() : mixed||string|int

Used strings are those strings requested and found either as a string or a constant.

since

1.0

Response

array<string|int, mixed>Used strings.

getWeekEnd

Get the weekends days for this language.

getWeekEnd() : 
since

2.0

Response

stringThe weekend days of the week separated by a comma according to the language

hasKey

Determines is a key exists.

hasKey( string) : 
since

1.0

Arguments

string

stringThe key to check.

Response

boolTrue, if the key exists.

isRtl

Get the RTL property.

isRtl() : 
since

1.0

Response

boolTrue is it an RTL language.

load

Loads a single language file and appends the results to the existing strings

load( extension = 'joomla',  basePath = '',  lang = null,  reload = false) : 
since

1.0

Arguments

extension

stringThe extension for which a language file should be loaded.

basePath

stringThe basepath to use.

lang

stringThe language to load, default null for the current language.

reload

boolFlag that will force a language to be reloaded if set to true.

Response

boolTrue if the file has successfully loaded.

loadLanguage

Loads a language file.

loadLanguage( filename,  extension = 'unknown') : 

This method will not note the successful loading of a file - use load() instead.

see Language::load()
since

1.0

Arguments

filename

stringThe name of the file.

extension

stringThe name of the extension.

Response

boolTrue if new strings have been added to the language

parse

Parses a language file.

parse( filename) : mixed||string|int
since

1.0

Arguments

filename

stringThe name of the file.

Response

array<string|int, mixed>The array of parsed strings.

parseLanguageFiles

Searches for language directories within a certain base dir.

parseLanguageFiles( dir = null) : mixed||string|int
static deprecated
see LanguageHelper::parseLanguageFiles()
since

1.0

deprecated

3.0 Use LanguageHelper::parseLanguageFiles() instead

Arguments

dir

stringdirectory of files.

Response

array<string|int, mixed>Array holding the found languages as filename => real name pairs.

parseXmlLanguageFile

Parse XML file for language information.

parseXmlLanguageFile( path) : 
static deprecated
see LanguageHelper::parseXMLLanguageFile()
since

1.0

deprecated

3.0 Use LanguageHelper::parseXMLLanguageFile() instead

Arguments

path

stringPath to the XML files.

Response

mixedArray holding the found metadata as a key => value pair or null on an invalid XML file

setCatalogue

Set the message catalogue for the language.

setCatalogue(\Joomla\Language\MessageCatalogue catalogue) : 
since

2.0

Arguments

catalogue

MessageCatalogueThe message catalogue to use.

Response

void

setDebug

Set the Debug property.

setDebug( debug) : 
since

1.0

Arguments

debug

boolThe debug setting.

Response

boolPrevious value.

setDefault

Set the default language code.

setDefault( lang) : 
since

1.0

Arguments

lang

stringThe language code.

Response

stringPrevious value.

translate

Translate function, mimics the php gettext (alias _) function.

translate( string,  jsSafe = false,  interpretBackSlashes = true) : 

The function checks if $jsSafe is true, then if $interpretBackslashes is true.

since

2.0

Arguments

string

stringThe string to translate

jsSafe

boolMake the result JavaScript safe

interpretBackSlashes

boolInterpret \t and \n

Response

stringThe translation of the string

transliterate

Transliterate function

transliterate( string) : 

This method processes a string and replaces all accented UTF-8 characters by unaccented ASCII-7 "equivalents".

since

1.0

throws

RuntimeException

Arguments

string

stringThe string to transliterate.

Response

stringThe transliteration of the string.

Properties

debug

Debug language, If true, highlights if string isn't found.

since

1.0

Type(s)

bool

default

The default language, used when a language file in the requested language does not exist.

since

1.0

Type(s)

string

orphans

An array of orphaned text.

since

1.0

Type(s)

array<string|int, mixed>

metadata

Array holding the language metadata.

since

1.0

Type(s)

array<string|int, mixed>

locale

Array holding the language locale or null.

since

1.0

Type(s)

array<string|int, mixed>|null

lang

The language to load.

since

1.0

Type(s)

string

paths

A nested array of language files that have been loaded

since

1.0

Type(s)

array<string|int, mixed>

errorfiles

List of language files that are in error state

since

1.0

Type(s)

array<string|int, mixed>

used

An array of used text, used during debugging.

since

1.0

Type(s)

array<string|int, mixed>

counter

Counter for number of loads.

since

1.0

Type(s)

int

override

An array used to store overrides.

since

1.0

Type(s)

array<string|int, mixed>

localise

The localisation object.

since

2.0

Type(s)

LocaliseInterface

helper

LanguageHelper object

since

2.0

Type(s)

LanguageHelper

basePath

The base path to the language folder

since

2.0

Type(s)

string

catalogue

MessageCatalogue object

since

2.0

Type(s)

MessageCatalogue

parserRegistry

Language parser registry

since

2.0

Type(s)

ParserRegistry