Hi Reid,

I'm sending this to Chandler-dev so that every dev remembers those rules or Bkirsch and me are gonna go crazy when we'll start producing the first localized version... :)

When declaring formatting strings for things that are displayed to the user, there are several things you need to remember (of course, skip to the end to see the string in its glorious final state...):
- you need to declare unicode strings, i.e.:
   do not write fmt = "%d. %s: %s"
   but write fmt = u"%d. %s: %s"
- you need to get the string to go through the translation service, i.e.:
   do not write fmt = u"%d. %s: %s"
   but write fmt = _(u"%d. %s: %s")
assuming that at the beginning of the python file you'll have imported the service using:
      from i18n import OSAFMessageFactory as _
- you need to use named arguments (very important for localizers), i.e.:
   do not write fmt = _(u"%d. %s: %s")
   but write fmt = _(u"%(conflictNumber)d. %(fieldTitle)s: %(fieldValue)s")
   then when you create the final string, you can use something like:
finalString = fmt % {conflictNumber : i, fieldTitle : c.field.title(), fieldValue : c.value} - last, you need to declare as many strings as they are cases so, *never, ever* use string concatenation, i.e.:
   do not write
      if (condition):
          fmt += " (changed on server)"
      else
         fmt += " (changed by %s)" % c.peer
   but write
      if (condition):
fmt = _(u"%(conflictNumber)d. %(fieldTitle)s: %(fieldValue)s (changed on server)")
      else
fmt = _(u"%(conflictNumber)d. %(fieldTitle)s: %(fieldValue)s (changed by %(peer)s)")

All of this is so that, when localizers (i.e. me in French...) look at the po file, we see things like:

   %(conflictNumber)d. %(fieldTitle)s: %(fieldValue)s (changed on server)

so we have a chance to understand, change, rearrange, add preposition, etc... as required by the grammar we're translating to.

More on all this here: http://people.osafoundation.org/bkirsch/i18n/busydev.html

Cheers,
- Philippe

[EMAIL PROTECTED] wrote:

Revision
    14424 <http://viewcvs.osafoundation.org/chandler?view=rev&rev=14424>
Author
    rae
Date
    2007-05-25 12:19:53 -0700 (Fri, 25 May 2007)


      Log Message

Changing language in conflict dialog for bug 9191 <http://bugzilla.osafoundation.org/show_bug.cgi?id=9191> (Parse pending changes) This is a simple text fix; more work may be required to add more information
(like when the change happened, and making the change text copy-able)


      Modified Paths

    * trunk/chandler/application/dialogs/ConflictDialog.py
      <#trunkchandlerapplicationdialogsConflictDialogpy>


      Diff


        Modified: trunk/chandler/application/dialogs/ConflictDialog.py
        (14423 => 14424)

--- trunk/chandler/application/dialogs/ConflictDialog.py        2007-05-25 
19:15:59 UTC (rev 14423)
+++ trunk/chandler/application/dialogs/ConflictDialog.py        2007-05-25 
19:19:53 UTC (rev 14424)
@@ -35,13 +35,13 @@
         i=1
         itemList=[]
         for c in conflicts:
-            fmt = "%d. %s: %s"
+            fmt = "%d. %s changed the %s to \"%s\""
             if c.peer:
                 if isinstance(c.peer, sharing.Share):
-                    fmt += " (changed on server)"
+                    editor = "Server"
                 else:
-                    fmt += " (changed by %s)" % c.peer
-            itemList.append(fmt % (i, c.field.title(), c.value))
+                    editor = c.peer
+            itemList.append(fmt % (i, editor, c.field.title(), c.value))
             i = i+1
         listBox = wx.ListBox(self, -1, choices=itemList)
         changesText = wx.StaticText(self, -1,

------------------------------------------------------------------------

_______________________________________________
Commits mailing list
[EMAIL PROTECTED]
http://lists.osafoundation.org/mailman/listinfo/commits
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to