UnionOfRAD/lithium — pull request #999 by JasperTey (2013-07-25 22:31:07+00:00)
Title: Implementation of translation contexts.

# Overview
This update implements support for translation contexts. With this, a disambiguating context can be specified across identical strings:

```php

'Spherical object')); ?>
'Social gathering')); ?>
// The null case
```
# Catalog Adapters
## Code
The updated code adapter will parse message contexts from source code, even in situations where insertions and nested syntax are used:

```php
$t('Michael, {:b}', array('b' => $t('Bruce', array('context' => 'Lee')), 'context' => 'Jackson')), 'context' => 'Hood')); ?>
```

## Gettext
The gettext adapter will write contexts using the "msgctxt" string. See http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html (2.2.2. Disambiguating Contexts):

```po
# ...
msgctxt "Spherical object"
msgid "Ball"
msgstr ""

# ...
msgctxt "Social gathering"
msgid "Ball"
msgstr ""

# ...
msgid "Ball"
msgstr ""
```
These context strings will be detected when .po and .mo files are read by the gettext adapter, whenever applicable.

## PHP
When reading PHP data, contexts are specified in the array key, delimited by a pipe character. If no context is required (or null context), array keys are the Message ID alone, as usual.
```php
'vert',
'fast|speed' => 'rapide',
'fast|go without food' => 'jeûner'
);
?>
```