Localization in a Theme

Topics: Writing themes
Sep 28, 2014 at 2:18 AM
I had a problem today. I have some localization strings in my theme and I created a *.po file with poEdit.

poEdit created Entries like this:
#: Themes/Bootstrap/Views/Orchard.Search/Search/Index.cshtml
msgid "Search"
msgstr "Suche"
But it didn't worked - no localization in my theme. I started debugging and found out that the correct entry has to be:
#: ~/Themes/Bootstrap/Views/Orchard.Search/Search/Index.cshtml
msgid "Search"
msgstr "Suche"
or i removed all comments like this:
msgid "Search"
msgstr "Suche"
because Orchard searchs for a key like this: "~/Themes/Bootstrap/Views/Orchard.Search/Search/Index.cshtml|Search" or in the next step for a key like "|Search".

I am prefering the first option, but I wasn't able to config poEdit in a way to do it automatically. Now my Questions:
  • Does anyone know how I am able to use poEdit for the first entry?
  • How was it intended form the Orchard devs ? (first or second entry in themes?)
Sep 28, 2014 at 3:11 AM
I am not familiar with poEditor, so I can't help you with that.
Regarding your second question, I would guess the second entry, as it makes most sense: it includes the tilde, which means: starting from the application root. Passing along such paths is convenient when mapping them to local paths.
Sep 28, 2014 at 4:42 AM
Hi, thanks for the reply!

poEdit is a graphical interface for gettext.

The second and thirth Entry work, but the problem with the second entry, I also prefer, is that it can't be automatically generated by the gettext parser. The gettext parser, as far as I know, uses the normal folder structure to determine the location of the string.

How you guys doing localization in your modules or themes? Do you use a pogram or do it by hand?
Sep 28, 2014 at 5:15 AM
I never used it myself, but there is a translations manager module somewhere that is being used to generate the PO files. I think this is the one: https://orchardtranslation.codeplex.com/ , but I'm not sure as there doesn't seem to be much activity going on there (or maybe that's because it works so well :)).
Marked as answer by benschi11 on 10/1/2014 at 12:39 PM
Oct 1, 2014 at 7:39 PM
Thanks for bringing me on the right track. This module has been moved into a feature bundle here : https://vandelay.codeplex.com and it works like charm.

Starting orchard.exe into a cmd or a powershell and type
extract default translation /Output:C:/temp
did the trick and extracts all the translation ant put it in an zip - Perfect
Marked as answer by benschi11 on 10/1/2014 at 12:39 PM