Yuri, I have put your link and Paul's recommendations on a wiki page.
https://wiki.audacityteam.org/wiki/Making_Audacity_Translatable

It is linked to from developer and translator landing pages.
https://wiki.audacityteam.org/wiki/For_Translators


On 1/4/2018 4:43 PM, Yuri Chornoivan wrote:
четвер, 4 січня 2018 р. 17:37:18 EET Paul Licameli написано:
Translators, I excerpt some things I recently wrote to the development
list.  I want to make other developers aware of the right and wrong ways to
code strings that must be translated.

Do you think these are good recommendations?  Would you add any?

Here are some rules I recommend:

    - Some languages prefer other punctuation conventions, such as «these»
    quotes, or such as leaving a space left of a colon  -- therefore, use _()
even for a format like _("%s: %s") that contains only % slots and
punctuation.


    - Some languages vary words contextually, for gender agreement or case,
    though this happens very little in English -- therefore, avoid putting
    small isolated words into _() which you then substitute into a longer
    string.  Instead, make longer phrases in _() containing words to be
    translated in context.  Do this even at the cost of repetitious code that
defines more strings, varying only the short word inside a longer phrase


    - Some languages prefer different word order, such a Japanese with verbs
    last and postpositions rather than prepositions. -- Therefore, avoid
    composition of user-visible strings using contatentation (+ operator) of
    many single words and short phrases.  Use format substitutions instead to
put words in place.  Concatenate long phrases and clauses only.

For example:

AudacityMessageBox(_("Could not open file: ") + fileName); // wrong
AudacityMessageBox( wxString::Format( _("Could not open file: %s"),
fileName )); // right

    - Some languages have more than two number forms of nouns (singular and
    plural); most of the Slavics have complicated case-agreement rules for
    various numerals, and Arabic has a dual.  -- Therefore use the wxPLURAL
    macro, which cooperates with the message catalog system, so that a
language can provide more than two translations as appropriate, and the
run-time lookup chooses the right one according to a number. For example

   // wrong:
    auto format = iHours == 1 ? _("%d hour") : _("%d hours");
    auto sHours = wxString::Format( format, iHours );

   // right:
    auto sHours =
       wxString::Format( wxPLURAL("%d hour", "%d hours", iHours), iHours );

    - In general, substitute only names and numbers into translated formats,
    not results of other translations, though there remain some difficult
cases where that rule must be relaxed.


PRL
Hi,

Wonderful tips! Many thanks for your work!

If it is possible, recommendations on layouts can be added. Some of them are
explained in KDE Tutorial:

https://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes

Best regards,
Yuri


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Audacity-translation mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-translation



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Audacity-translation mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-translation

Reply via email to