Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • Apc
  • App
  • ArrayCache
  • Asset
  • Base
  • BaseCache
  • BaseController
  • Bicache
  • Cache
  • Config
  • Cookie
  • Couchbase
  • Counter
  • Db
  • DbCache
  • E
  • Env
  • Error
  • FileCache
  • Gravatar
  • Http
  • Lock
  • Logger
  • Memcache
  • Memcached
  • MongoCache
  • Password
  • PhpError
  • PhpFileCache
  • Pinyin
  • Record
  • Redis
  • Request
  • Response
  • Router
  • SafeUrl
  • Session
  • Soap
  • T
  • Ua
  • Upload
  • Url
  • Uuid
  • Validate
  • View
  • WeChatApp
  • Wei
  • Overview
  • Namespace
  • Class

Class T

A translator wei

Wei\Base
Extended by Wei\T
Namespace: Wei
Author: Twin Huang twinhuang@qq.com
Located at T.php
Methods summary
public string
# __invoke( string $message, array $parameters = array() )

Translate a message

Translate a message

Parameters

$message
$parameters

Returns

string
public string
# trans( string $message, array $parameters = array() )

Translates a message

Translates a message

Parameters

$message
$parameters

Returns

string
public
# setLocale( string $locale )

Sets the current locale

Sets the current locale

Parameters

$locale

Returns


$this
public string
# getLocale( )

Returns the default locale

Returns the default locale

Returns

string
public
# setDefaultLocale( string $locale )

Set the fallback locale

Set the fallback locale

Parameters

$locale

Returns


$this
public string
# getDefaultLocale( )

Returns the fallback locale

Returns the fallback locale

Returns

string
public
# loadFromFile( string $pattern )

Loads translator messages from file

Loads translator messages from file

Parameters

$pattern
The file path, which can contains %s that would be convert the current locale or fallback locale

Returns


$this

Throws

InvalidArgumentException
When file not found or not readable
public
# loadFromArray( array $messages )

Loads translator messages from array

Loads translator messages from array

Parameters

$messages

Returns


$this
public
# load( Closure $fn )

Loads translator messages from closure

Loads translator messages from closure

Parameters

$fn

Returns


$this
Methods inherited from Wei\Base
__call(), __construct(), __get(), getOption(), setOption()
Properties summary
protected string $locale

The current locale

The current locale

# 'en'
protected string $defaultLocale

The default locale

The default locale

# 'en'
protected array $data

The translator messages

The translator messages

# array()
protected array $files

The loaded translation files

The loaded translation files

# array()
Properties inherited from Wei\Base
$providers, $wei
Wei Framework API documentation generated by ApiGen