wiki:TranslationGuidelines

Version 2 (modified by tarmo, 13 years ago) (diff)

Added instructions for translators and developers

Guidelines for Translators

General instructions are provided in Plone translation guidelines. Here's a quick summary:

  1. Download i18n/lemill.pot
  2. Rename it to lemill-XX.po where XX is your language code
  3. Open the file in your favourite translation editor:
    • KBabel
    • GTranslator
    • poEdit
    • any text editor that understands UTF-8 and saves normal text files (no word processing software!)
  4. Edit the msgstr strings so that they are the translations of the string shown in the "Default" line
  5. (optional) Place the file into your local Zope's Products/LeMill?/i18n, restart Zope, and test the translation yourself
  6. Send the translated file to Tarmo.Toikkanen@….
  7. Later, there will be need for additional translations as new strings get added, so check back regularly (or: Tarmo will probably ask you every now and then) to download the translation file and translate any new or changed strings it contains, and send the results back.

Guidelines for developers

How to keep LeMill easily translatable:

  • .pt files:
    • All static text strings in .pt files that are visible to the user must have i18n:translate="msgid" (or i18n:attributes="attr msgid;" if they are in tag attributes)
    • Always use explicit msgids (meaning: no i18n:translate="" anywhere)
  • .py files:
    • All user-visible strings from python scripts (.py files) must use context.translate("string")
  • msgids:
    • Use the naming convention of msgids found in Plone translation guidelines
    • If you use the same msgid in several places, the contents must be exactly the same in each place.
  • domains:
    • If the template contains only (or mostly) our own strings, make sure that the template starts with i18n:domain="lemill"
    • If the template contains mostly Plone's own strings, start the template with i18n:domain="plone"
    • If you need to add a string from the other translation domain (lemill vs. plone), add i18n:domain="plone" to a suitable location in the xml hierarchy - everything inside it will use that domain
  • reusing strings:
    • When doing new strings, grep lemill.pot to see if a suitable string is already there, and use that.
    • When doing new strings that seem quite generic (like "Save" or "Edit"), check if Plone's translations already contain it, and use it by switching the translation domain
  • dynamic strings:
    • Dynamic text strings (generated with tal:content or tal:replace) usually don't have translation attributes. If, however, a dynamic string needs to be translated, then do one of these two things:
      • Add i18n:translate="" and then add manually the string into lemill.pot, using as msgid the exact string that will be dynamically generated
      • Add tal:attributes="i18n:translate string:foo_$value" and add manually all possible msgids (foo_$value combinations) into lemill.pot, with Default values matching the exact strings that will be dynamically generated for each value