PHP Class Jarves\Translation\Translator

Inheritance: implements Jarves\Translation\TranslationInterface
Mostra file Open project: jarves/jarves Class Usage Examples

Protected Properties

Property Type Description
$jarves Jarves\Jarves
$messages

Public Methods

Method Description
__construct ( Jarves $jarves, Cacher $cacher, Filesystem $webFilesystem, Filesystem $cacheFilesystem ) Translator constructor.
getLanguage ( $file )
getPluralForm ( $lang, $onlyAlgorithm = false )
getPluralJsFunctionFile ( $lang ) : string
getPluralPhpFunctionFile ( $lang )
getUtils ( ) : Utils
isValidLanguage ( string $lang ) : boolean Check whether specified pLang is a valid language
loadMessages ( string $lang = 'en', boolean $force = false ) : array | null | string
t ( $id, $plural = null, $count, $context = null )
tc ( $context, $id, $plural = null, $count )

Method Details

__construct() public method

Translator constructor.
public __construct ( Jarves $jarves, Cacher $cacher, Filesystem $webFilesystem, Filesystem $cacheFilesystem )
$jarves Jarves\Jarves
$cacher Jarves\Cache\Cacher
$webFilesystem Jarves\Filesystem\Filesystem
$cacheFilesystem Jarves\Filesystem\Filesystem

getLanguage() public method

public getLanguage ( $file )

getPluralForm() public method

public getPluralForm ( $lang, $onlyAlgorithm = false )

getPluralJsFunctionFile() public method

public getPluralJsFunctionFile ( $lang ) : string
$lang
return string Returns the public accessible file path

getPluralPhpFunctionFile() public method

public getPluralPhpFunctionFile ( $lang )

getUtils() public method

public getUtils ( ) : Utils
return Utils

isValidLanguage() public method

Check whether specified pLang is a valid language
public isValidLanguage ( string $lang ) : boolean
$lang string
return boolean

loadMessages() public method

public loadMessages ( string $lang = 'en', boolean $force = false ) : array | null | string
$lang string
$force boolean
return array | null | string

t() public method

public t ( $id, $plural = null, $count, $context = null )

tc() public method

public tc ( $context, $id, $plural = null, $count )

Property Details

$jarves protected_oe property

protected Jarves,Jarves $jarves
return Jarves\Jarves

$messages protected_oe property

protected $messages