wiki:TranslationGuidelines
Last modified 11 years ago Last modified on 12/14/06 02:55:13

Translation guidelines for developers

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

  1. Download lemill.pot
  2. Rename it to lemill-XX.po where XX is your language code
  3. Open the file in your favourite translation editor:
  4. There are two types of translatable items:
    • Items with msgid. The original string is in a comment line with the word "Default:". The msgid is an abbreviation for the string, in the form "label_something". The first part or the msgid tells the type of the string, and gives you hints on where it is being used.
    • Items without msgid. The original string in in the msgid line.
  5. Edit the msgstr line of each item to contain the translation of the original string.
  6. Some strings will have placeholders, in the format of "${placeholder}". The word in curly braces must not be translated, but must stay the same. You may move the placeholders in your translation as you see fit. In LeMill the placeholders are always replaced with some dynamic content. The word in the placeholder tells you what is going to be inserted in its place.
  7. (optional) Place the file into your local Zope's Products/LeMill?/i18n, restart Zope, and test the translation yourself
  8. Send the translated file to Tarmo.Toikkanen@….
  9. 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.

We have less technical translation guidelines for CALIBRATE partners.

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.
    • Also grep PloneTranslations?/i18n/plone.pot to see if a suitable string is there, and use that (add i18n:domain="plone")
  • 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 this:
      • Add i18n:translate="" and then either add the string into i18n/utils/extramsgids.txt or modify tests/extractTranslations.py to include the strings