2

We have a Pyramid application which we must have in English, Spanish and French. We have completed our first pass of i18n, however we are troubled about how to introduce no-break spaces in our translate strings.

For instance we have the following:

USER_UPDATED = _('User "${user}" updated!')

When translating to French, this must be changed to:

Utilisateur « ${user} » mise à jour !

But the space after the « and the ones before the » and the ! must be non-breaking.

When editing the PO file, how do I put the no-break space where it should be? I use Emacs PO mode, and I haven't found a way to do this.

manu
  • 3,544
  • 5
  • 28
  • 50

1 Answers1

2

Use the HTML entity   or the Unicode character 160 (0xA0), same as in any other situation where you need a non-breaking space on a Web page. You may be able to enter the Unicode character directly using your editor, but frankly I'd advise using the HTML entity because it's clearer. You could also escape the character using the Python syntax \u00a0 if the HTML entity is not appropriate.

kindall
  • 178,883
  • 35
  • 278
  • 309
  • Putting   in PO files is a no-go cause some texts are actually meant to several media (mail for instance) and not just for HTML. But with "M-x ucs-insert RET A0 RET" I solved the issue. Pyramid (or Chameleon) seems to care about translating that to   – manu May 23 '13 at 17:09
  • It might be better to make it more visible with `u'Utilisateur «\u00a0${user}\u00a0» mise à jour\u00a0!'` – Aya May 23 '13 at 17:12
  • Thanks for that suggestion Aya, I've added it to my answer. – kindall May 23 '13 at 17:24
  • @Aya But that's only the case when I have the French strings in my code; but we use English in the code, and transtale to French in the PO files. – manu Jun 10 '13 at 17:03