[Chandler-dev] Upgrade script works for old localiztions (with some glitches)

Jonas Beckman jonas.beckman at indra.se
Thu Aug 16 17:54:28 PDT 2007


Hi again!

I am happy to report that the existing French and Finnish localizations 
are very easy to merge with the brand new Chandler-en.po file. All 
existing translations are preserved by my upgrade script and can be used 
in future versions.

But there is still a small glitch: before upgrading it is necessary to 
re-format a few messages which use newlines in unusual ways. The Swedish 
version had 15 such messages (out of 1314). The Finnish and French files 
were older and smaller and only had 4.

Regardless of language the same kind of strings causes errors. 
Everything appears to work: an upgraded file is generated and the new 
localization egg works. But our po_check script finds errors: some 
msgstr messages are incomplete.

This really annoyed me, so I spent some time inside Wing yesterday. It 
turns out the PO parser does the right thing in memory. Everything is 
parsed correctly and ready to go. But the string representation of PO 
messages can't handle newlines in strange places - so when the parsed PO 
file is saved to disk some lines are missing.

I could fix this this by adding more complex parser logic for newlines. 
Or we could pre-format the input files before upgrading. But that's 
messy and feels like overkill. This is just my opinion - but I think the 
problem here is that a small number of localizable strings need more 
appropriate formatting.

This is some Chandler code that triggers my localization problem (from 
feedback.py):

self.frame.text.AppendText(_(u'\nFeedback report ID: %(feedbackId)s') % 
{'feedbackId': feedbackId})

The initial newline here is just GUI formatting. That is easy to find 
and hopefully not very dificult to change.

Here is another one (from parcels.osaf.framework.certstore.dialogs.py):

message = _(u'There was an error with this SSL connection.\nThe error 
was: %s.\nIgnoring this error may be dangerous!\nSHA1 fingerprint: %s') 
% (errString, utils.fingerprint(x509))

The combination of %s and newlines breaks things later. This is much 
harder to spot. But the basic problem is exactly the same: newlines are 
used for GUI formatting inside a localizable string.

Anyway... I guess this should really wait until after preview. I'll take 
a look at Bugzilla now. Good luck and happy bug hunting, everyone!

/ Jonas


More information about the chandler-dev mailing list