-
Incident report
-
Resolution: Fixed
-
Major
-
1.9.8 (beta)
I decided to do the experiments and select the best style to write translatable strings in context with/without comments.
Tested:
1. Pootle
2. Virtaal
3. Lokalize
4. Poedit
See attached pictures.
Considered two different styles of source code.
a) on top of the pictures:
// GETTEXT: button for switch pages
$pagespan = new CSpan('<< '._x('First', 'page'), 'darklink');
b) bottom of the picture:
$pagespan = new CSpan(_x('Last', 'context: page').' >>', 'darklink');
In the case a) I used short context definition ('page') and the comment for gettext.
In the case b) I used more complex context definition ('context: page') without the comment for gettext.
We need to discuss and select the best style regarding to save source code clear and to give for translators as much help as possible.
My personal conclusion:
- usage only context is not enough in most cases, so need to use comments too where context is used. But it's not hard rule, it's recommendation.
- usage the fixed part "context: " as prefix for all context strings helps to read source code and to use all mentioned tools tor translation.
So I propose the style:
// GETTEXT: button for switch pages
$pagespan = new CSpan('< '._x('Previous', 'context: page'), 'darklink');
See corresponding attached picture.
According to the "best style" a patch prepared.
Next patches will be prepared after approving current style or select another.
Documentation will be updated:
http://www.zabbix.com/documentation/2.0/contrib/frontend_localisation#code_conventions
p.s. some bad comment was fixed in the patch:
The comment format of "// GETTEXT: r is date format string as described in http://php.net/date"
was changed to "/* */" because this comment really was used for the word "Updated" but not for the word "r"
- is duplicated by
-
ZBXNEXT-790 Clean up Zabbix front-end to make use of gettext localization functions instead of S_* constants
- Closed