2

I have tried to understand how to manage and translate Orchard PO files as described in: http://weblogs.asp.net/bleroy/archive/2011/01/13/creating-and-maintaining-orchard-translations.aspx

The problem started when I have tried to use some Editors that I found in internet and I noticed that:

  • orchard translation files produced by Vandelay.TranslationManager may be invalid
  • edited files in external editor may broke PO translated files and prevent to use sync (valid keys are marked as obsolete and new one are added as untranslated)

First things first I tried to get a reliable explanation of PO file format, and I found here: http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html

Summary of specs:

  • A message in the PO file is uniquely identified by its msgid string
  • When same msgid is used in different files an optional context can be used to distinguish between same msgid

After digging a bit in Vandelay.TranslationManager and all translated files I think I have found the problem.

Vandelay.TranslationManager assumes as unique Key a combination of two values: - #| msgid (used as translation key) - msgctxt (the optional context, that in Orchard is always defined)

The problem is that Vandelay.TranslationManager uses as unique key "#| msgid" instead of "msgid" "#| msgid" is used in fuzzy strings and states previous untranslated string, in orchard is used as an extra information that seems more a "#. "

example of extracted PO file:

#: ~/Modules/nwazet.commerce/Module.txt
#| msgid "Nwazet.Commerce.Category"
msgctxt ~/Modules/nwazet.commerce/Module.txt
msgid "Commerce"
msgstr "Commerce"

#: ~/Modules/nwazet.commerce/Module.txt
#| msgid "Nwazet.Bundles.Category"
msgctxt ~/Modules/nwazet.commerce/Module.txt
msgid "Commerce"
msgstr "Commerce"

note that even if the "#| msgid" are different the two entries above are indeed duplicates according specifications.

Now the question: Is that just a bug or a precise design? Afaik Vandelay.TranslationManager is the recommended way to deal with Po files in Orchard. Any other have problems in using this feature? Thanks

manudea
  • 371
  • 2
  • 15

1 Answers1

0

The recommended way to deal with Orchard po files is the online translation tool: http://orchardproject.net/localize

Bertrand Le Roy
  • 17,731
  • 2
  • 27
  • 33
  • I know... but this works only for relased modules the have keys submitted first. – manudea Apr 13 '13 at 08:12
  • Sample scenario: I have installed Nwazet Commerce. Released version has a very small subset of features, bitbucket one has 100+. I plan to use module for my clients and possibly contribute on development with fixes or new features, in meantime I need to release the module, test and have a fully localized version to use. – manudea Apr 13 '13 at 08:23
  • I cannot use online tool in this scenario, the only tool available is translation manager. And in this scenario I found problems. I have translated all Commerce keys in Italian http://orchardproject.net/localize/Module/Nwazet.Commerce/it-IT , I downloaded the translated keys and I have tried to sync translation to add missing keys added in development version. So I found the troubles, all translated keys were marked as obsolete and added again as new untranslated keys. – manudea Apr 13 '13 at 08:24
  • This was the start of investigation the lead me to read translation manager code and found a fix for that. Now the fix I did works for me but needs a review from orchard and translation manager team to see if it fits with the rest of project code. A patch that works for me can be found here: https://vandelay.codeplex.com/workitem/24 – manudea Apr 13 '13 at 08:24
  • We need to find a better solution for module translations. There is a module on the gallery that manages translations in DB instead of po files but I don't know how well it works. – Bertrand Le Roy Apr 14 '13 at 04:51
  • Well translation manager works (at least with applied fixes) and it is a valid tool for me right now... It does the hard work of extracting keys from sources and synchronization now works ;) – manudea Apr 14 '13 at 21:04
  • The Q42translation module works pretty well. With the help of another user I was able to use it with 1.7. It captures most everything, except still having problems with dynamic or datannotations. – REMESQ Aug 26 '13 at 16:40