Le 04/05/2013 18:20, Roland Mas a écrit :
Franck Villaume, 2013-05-03 18:34:48 +0200 :[...]A little bit of consistency may help us for translations. My proposition (valid for the source code only): 1) no more all CAPS word. 2) A sentence ends by a period '.' 3) First letter of the first word has capital case. 4) We use only one colon ':' between level of information and message. 5) There is no space between level of information and the colon. 6) level of information + colon = one word. 7) There is one space between the colon and the message. 8) gettext must be used as much as possible. Add a comment in your code to specify when not using gettext.Fully agreed on all that.If I apply these rules on the above samples, I get : $error_msg = _('Error: please confirm the deletion of the role.'); $error_msg = _('Error: both subject and body are required.'); $error_msg = _('Error: doing insert.'); $this->setError(_('Error: you can\'t set pending status if user is suspend or active'));Missing period at the end of this one?
Yes. Missing period.
$error_msg .= _('Error:').' '.$acr->getErrorMessage();For this case, and many like it, it would probably be better to use a sprintf() call: $error_msg .= sprintf(_('Error: %s'),$acr->getErrorMessage());
Rule 9:
No space, colon, period concatenation. sprintf function is mandatory.
Sample code is :
$error_msg .= _('Error') . _(': ') . $acr->getErrorMessage();
New code should be :
$error_msg .= sprintf(_('Error: %s'), $acr->getErrorMessage());
Not every language uses a space after a colon, so the choice of whether to use one should be made by the translators and not the authors of the code. There are plenty of cases where strings are constructed with _('one word').':'._('something else') and so on. These should be converted to longer strings when possible. In some cases and some languages, the translation may not even include a colon.$feedback .= _('Canned response deleted.'); I'm fully aware all rules wont apply for each translation. (I dont know about german punctuation rules)The good thing is that the translated strings can then use a different set of rules, local to the language. As long as the original strings are consistent, the end result will be as consistent as the translations. But the "gettextized" string must be as close as possible to the full message one wants to display; see the example above with sprintf(). Roland.
Regards, Franck -- TrivialDev Founder http://trivialdev.com
<<attachment: franck_villaume.vcf>>
_______________________________________________ Fusionforge-general mailing list [email protected] http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-general
