Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renaming `Message::shorthands()` to `Message::aliases()`.

  • Loading branch information...
commit cdcd170e08be88f73c0e020bca854b79cb727f58 1 parent a832eb1
@davidpersson davidpersson authored
View
6 app/config/bootstrap/g11n.php
@@ -107,13 +107,13 @@
/**
- * Integration with `View`. Embeds message translation short-hands into the `View`
+ * Integration with `View`. Embeds message translation aliases into the `View`
* class (or other content handler, if specified) when content is rendered. This
- * enables short-hand translation functions, i.e. `<?=$t("Translated content"); ?>`.
+ * enables translation functions, i.e. `<?=$t("Translated content"); ?>`.
*/
Media::applyFilter('_handle', function($self, $params, $chain) {
$params['handler'] += array('outputFilters' => array());
- $params['handler']['outputFilters'] += Message::shorthands();
+ $params['handler']['outputFilters'] += Message::aliases();
return $chain->next($self, $params, $chain);
});
View
10 libraries/lithium/g11n/Message.php
@@ -21,7 +21,7 @@
* given here in order to help understanding the purpose of this class through the context
* of the process as a whole.
*
- * 1. Marking messages as translatable. `$t()` and `$tn()` (implemented in `shorthands()`)
+ * 1. Marking messages as translatable. `$t()` and `$tn()` (implemented in `aliases()`)
* are recognized as message marking and picked up by the extraction parser.
*
* 2. Extracting marked messages. Messages can be extracted through the `g11n`
@@ -102,7 +102,7 @@ public static function translate($id, $options = array()) {
}
/**
- * Returns an array containing named closures which are short-hand aliases for `translate()`.
+ * Returns an array containing named closures which are aliases for `translate()`.
* They can be embedded as content filters in the template layer using a filter for
* `Media::_handle()` or be used in other places where needed.
*
@@ -115,15 +115,15 @@ public static function translate($id, $options = array()) {
* Using in a method:
* {{{
* public function index() {
- * extract(Message::shorthands());
+ * extract(Message::aliases());
* $notice = $t('look');
* }
* }}}
*
- * @return array Named short-hand (`'t'` and `'tn'`) translation functions.
+ * @return array Named aliases (`'t'` and `'tn'`) for translation functions.
* @see lithium\net\http\Media::_handle()
*/
- public static function shorthands() {
+ public static function aliases() {
$t = function($message, $options = array()) {
return Message::translate($message, $options + array('default' => $message));
};
View
12 libraries/lithium/tests/cases/g11n/MessageTest.php
@@ -171,13 +171,13 @@ public function testTranslateNoop() {
$this->assertNull($result);
}
- public function testShortHandsBasic() {
+ public function testAliasesBasic() {
$data = array(
'house' => array('Haus', 'Häuser')
);
Catalog::write('message', 'de', $data, array('name' => 'runtime'));
- $filters = Message::shorthands();
+ $filters = Message::aliases();
$t = $filters['t'];
$tn = $filters['tn'];
@@ -194,13 +194,13 @@ public function testShortHandsBasic() {
$this->assertEqual($expected, $result);
}
- public function testShortHandsSymmetry() {
+ public function testAliasesSymmetry() {
$data = array(
'house' => array('Haus', 'Häuser')
);
Catalog::write('message', 'de', $data, array('name' => 'runtime'));
- $filters = Message::shorthands();
+ $filters = Message::aliases();
$t = $filters['t'];
$tn = $filters['tn'];
@@ -217,8 +217,8 @@ public function testShortHandsSymmetry() {
$this->assertEqual($expected, $result);
}
- public function testShortHandsAsymmetry() {
- $filters = Message::shorthands();
+ public function testAliasesAsymmetry() {
+ $filters = Message::aliases();
$t = $filters['t'];
$tn = $filters['tn'];
Please sign in to comment.
Something went wrong with that request. Please try again.