codingConventions.doxygen   codingConventions.doxygen 
skipping to change at line 169 skipping to change at line 169
- Use stdc++ math functions instead of C ones. There are more portable and are also overrided for float, thus may be faster. - Use stdc++ math functions instead of C ones. There are more portable and are also overrided for float, thus may be faster.
@code @code
double cosLat = cos(lat); // Bad double cosLat = cos(lat); // Bad
double cosLat = std::cos(lat); // Good double cosLat = std::cos(lat); // Good
@endcode @endcode
@section translation_sec Translatable Strings and Console Output @section translation_sec Translatable Strings and Console Output
Translatable strings are translated using the StelTranslator class, which i s Translatable strings are translated using the StelTranslator class, which i s
a C++ wrapper around <a href="http://www.gnu.org/software/gettext/">gettext </a>. a C++ wrapper around <a href="http://www.gnu.org/software/gettext/">gettext </a>.
A string literal can be marked for translation in with two different macros A string literal can be marked for translation in with three different macr
, os,
@c q_() or @c N_() , and you need to pick one for the appropriate purpose: @c q_(), @c qc_() or @c N_() , and you need to pick one for the appropriate
purpose:
- The @c q_() macro takes a string in English and returns the translation as - The @c q_() macro takes a string in English and returns the translation as
a QString using the current global language. This also allows calling @c q _() a QString using the current global language. This also allows calling @c q _()
with a QString parameter to return a translation. with a QString parameter to return a translation.
- The @c qc_() macro is similar previous - he takes a two parameters - str
ing in English
and context of the string, and returns the translation as a QString using
the current
global language. This also allows calling qc_() with a two QString paramet
ers to return
a translation.
- When a string literal needs to be marked for translation without returni ng - When a string literal needs to be marked for translation without returni ng
a translation, use the @c N_() macro. It returns the original string. a translation, use the @c N_() macro. It returns the original string.
Several guidelines: Several guidelines:
- Translatable text in sources or data files should be written in English, encoded in ASCII or UTF-8 if needed. - Translatable text in sources or data files should be written in English, encoded in ASCII or UTF-8 if needed.
- Translatable strings should be modified only if really necessary. Any mo dification to one of them means that all the translators for all the langag es will have to re-translate the new string. - Translatable strings should be modified only if really necessary. Any mo dification to one of them means that all the translators for all the langag es will have to re-translate the new string.
This also means that new strings should be chosen carefully, to avoid the need to modify them later. This also means that new strings should be chosen carefully, to avoid the need to modify them later.
- Do not concatenate strings, use @c QString::arg() instead. Concatenated strings are very hard (or even impossible) to translate. - Do not concatenate strings, use @c QString::arg() instead. Concatenated strings are very hard (or even impossible) to translate.
@code @code
text << q_("Distance: ") << distance << q_("AU"); // Bad text << q_("Distance: ") << distance << q_("AU"); // Bad
 End of changes. 2 change blocks. 
3 lines changed or deleted 11 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/