language
in package
FanPress CM Language handler
Tags
Table of Contents
- LANGCODE_VALIDATION = '/[^a-zA-Z0-9\\-]/'
- VARTEXT_NEWLINE = '[NL]'
- FILENAME_LISTS = 'lists'
- FILENAME_VARS = 'vars'
- $cache : cache
- Sprach-Cache
- $helpFile : string
- Pfad zu Hilfe-Datei
- $langCode : string
- Language code
- $langList : array<string|int, mixed>
- Languages list
- $langPath : string
- Pfad für Sprachpaket
- __construct() : bool
- Konstruktor
- getAll() : array<string|int, mixed>
- Returns full language data
- getDays() : array<string|int, mixed>
- Gibt sprachspezifische Tage zurück
- getDaysShort() : array<string|int, mixed>
- Gibt sprachspezifische Tage zurück
- getHelp() : string
- Gibt Hilfe-XML-String zurück
- getLangCode() : string
- Gibt aktuellen Sprachcode zurück
- getLanguages() : array<string|int, mixed>
- Gibt installierte Sprachpakete zurück
- getMonths() : array<string|int, mixed>
- Gibt sprachspezifische Monate zurück
- replaceSpecialCharacters() : string
- Replaces special characters of current language
- saveFiles() : bool
- Save language vars to corresponding files
- translate() : string
- Return value of language variable
- write() : void
- Directly writes text of given language variable
- writeMonth() : type
- Ersetzt Monat (1-12) in sprachspezifischen String
- addModulePrefix() : mixed
- Add module prefix to language vars
- getFileName() : string|null
- Get language file name and path
- getModuleLanguage() : void
- fetch module language files
- init() : bool
- Load language variables
- loadDataFromSystem() : void
- Load language data from file
- writeNewFile() : bool
- Write file content
Constants
LANGCODE_VALIDATION
public
mixed
LANGCODE_VALIDATION
= '/[^a-zA-Z0-9\\-]/'
VARTEXT_NEWLINE
public
mixed
VARTEXT_NEWLINE
= '[NL]'
FILENAME_LISTS
private
mixed
FILENAME_LISTS
= 'lists'
FILENAME_VARS
private
mixed
FILENAME_VARS
= 'vars'
Properties
$cache
Sprach-Cache
private
cache
$cache
$helpFile
Pfad zu Hilfe-Datei
private
string
$helpFile
= ''
$langCode
Language code
private
string
$langCode
= ''
$langList
Languages list
private
array<string|int, mixed>
$langList
= []
$langPath
Pfad für Sprachpaket
private
string
$langPath
= ''
Methods
__construct()
Konstruktor
public
__construct([string $langCode = '' ]) : bool
Parameters
- $langCode : string = ''
Return values
bool —getAll()
Returns full language data
public
getAll([bool $force = false ]) : array<string|int, mixed>
Parameters
- $force : bool = false
Tags
Return values
array<string|int, mixed> —getDays()
Gibt sprachspezifische Tage zurück
public
getDays() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDaysShort()
Gibt sprachspezifische Tage zurück
public
getDaysShort() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHelp()
Gibt Hilfe-XML-String zurück
public
getHelp() : string
Return values
string —getLangCode()
Gibt aktuellen Sprachcode zurück
public
getLangCode() : string
Return values
string —getLanguages()
Gibt installierte Sprachpakete zurück
public
getLanguages() : array<string|int, mixed>
Return values
array<string|int, mixed> —getMonths()
Gibt sprachspezifische Monate zurück
public
getMonths() : array<string|int, mixed>
Return values
array<string|int, mixed> —replaceSpecialCharacters()
Replaces special characters of current language
public
replaceSpecialCharacters(string $str) : string
Parameters
- $str : string
Tags
Return values
string —saveFiles()
Save language vars to corresponding files
public
saveFiles(array<string|int, mixed> $vars, array<string|int, mixed> $lists) : bool
Parameters
- $vars : array<string|int, mixed>
- $lists : array<string|int, mixed>
Tags
Return values
bool —translate()
Return value of language variable
public
translate(string|null $langvar[, array<string|int, mixed> $replaceParams = [] ][, bool $spf = false ]) : string
Parameters
- $langvar : string|null
-
language variable
- $replaceParams : array<string|int, mixed> = []
-
replacement values for placeholder in variable text
- $spf : bool = false
-
use vsprintf instead of old {{placehodler}} variables (@since 5.1-dev)
Return values
string —write()
Directly writes text of given language variable
public
write(string|null $langvar[, array<string|int, mixed> $replaceParams = [] ][, bool $spf = false ]) : void
Parameters
- $langvar : string|null
-
language variable
- $replaceParams : array<string|int, mixed> = []
-
replacement values for placeholder in variable text
- $spf : bool = false
-
use vsprintf instead of old {{placehodler}} variables (@since 5.1-dev)
Return values
void —writeMonth()
Ersetzt Monat (1-12) in sprachspezifischen String
public
writeMonth(int $monthId[, bool $return = false ]) : type
Parameters
- $monthId : int
- $return : bool = false
Return values
type —addModulePrefix()
Add module prefix to language vars
private
addModulePrefix(string &$val, string $key, array<string|int, mixed> $args) : mixed
Parameters
- $val : string
- $key : string
- $args : array<string|int, mixed>
Return values
mixed —getFileName()
Get language file name and path
private
getFileName(string $name) : string|null
Parameters
- $name : string
Tags
Return values
string|null —getModuleLanguage()
fetch module language files
private
getModuleLanguage() : void
Return values
void —init()
Load language variables
private
init() : bool
Tags
Return values
bool —loadDataFromSystem()
Load language data from file
private
loadDataFromSystem(string $name) : void
Parameters
- $name : string
Tags
Return values
void —writeNewFile()
Write file content
private
writeNewFile(string $file, string $content) : bool
Parameters
- $file : string
- $content : string