|
Previous Page |
Solar_Sql_Adapter_Pgsql |
Next Page |
locale()
public
string
locale (
string $key,
string $num default 1,
array $replace default NULL
)
Looks up class-specific locale strings based on a key.
Inherited from Solar_Base.
Parameters
- (string)
$key: The key to get a locale string for. - (string)
$num: If 1, returns a singular string; otherwise, returns a plural string (if one exists). - (array)
$replace: An array of replacement values for the string.
Returns
- (string) The locale string, or the original $key if no string found.
Description
Looks up class-specific locale strings based on a key.
This is a convenient shortcut for calling that automatically uses the current class name.
You can also pass an array of replacement values. If the $replace
array is sequential, this method will use it with vsprintf(); if the
array is associative, this method will replace "{:key}" with the array
value.
For example:
<?php
$page = 2;
$pages = 10;
// given a locale string TEXT_PAGES => 'Page %d of %d'
$replace = array($page, $pages);
return $this->locale('Solar_Example', 'TEXT_PAGES',
$pages, $replace);
// returns "Page 2 of 10"
// given a locale string TEXT_PAGES => 'Page {:page} of {:pages}'
$replace = array('page' => $page, 'pages' => $pages);
return $this->locale('Solar_Example', 'TEXT_PAGES',
$pages, $replace);
// returns "Page 2 of 10"
?>
See Also
Local
- Overview
- Constants
- Properties
- Methods
- __construct()
- __destruct()
- _addProfile()
- _bind()
- _buildDsn()
- _checkIdentifier()
- _createSequence()
- _dropIndex()
- _dropSequence()
- _exception()
- _fetchTableCols()
- _fetchTableList()
- _getCacheKey()
- _getDefault()
- _getTypeSizeScope()
- _modAutoincPrimary()
- _modIndexName()
- _modSelect()
- _modSequenceName()
- _nextSequence()
- _postConnect()
- _prepare()
- _quoteName()
- _quoteNamesIn()
- _select()
- _setDsn()
- _setup()
- _sqlColdef()
- _sqlCreateTable()
- _sqlSelect()
- addColumn()
- apiVersion()
- begin()
- commit()
- connect()
- createIndex()
- createSequence()
- createTable()
- delete()
- disconnect()
- dropColumn()
- dropIndex()
- dropSequence()
- dropTable()
- dump()
- fetchAll()
- fetchAssoc()
- fetchCol()
- fetchOne()
- fetchPairs()
- fetchPdo()
- fetchSql()
- fetchTableCols()
- fetchTableList()
- fetchValue()
- getCache()
- getCacheKeyPrefix()
- getPdo()
- getProfile()
- insert()
- lastInsertId()
- locale()
- nextSequence()
- query()
- quote()
- quoteInto()
- quoteMulti()
- quoteName()
- quoteNamesIn()
- rollback()
- setCache()
- setCacheKeyPrefix()
- setProfiling()
- update()