XML translation files, but PO template needed?

Asked by Andreas Wenger

We just moved our open source project, the game "Slam Soccer", to Launchpad.
I noticed that I need PO files for the translation templates, but our project uses XML files.
So I have no source code to parse to get PO files... Is it ok when I create PO files with just that format:

msgid "menu.file.new"
msgstr "Neue Datei..."

msgid "menu.file.open"
msgstr "Datei öffnen..."

"Project-Id-Version: Slam Soccer 2008\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2007-08-29 22:27+0100\n"
"Last-Translator: Andreas Wenger <email address hidden>\n"
"Language-Team: Xenoage Software <email address hidden>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: German\n"
"X-Poedit-Country: GERMANY\n"
"X-Poedit-SourceCharset: utf-8\n"

I ask this, because I do not want to create a large file that will be rejected later.
(Translation between PO and XML is no problem for me, I just want to know if Launchpad accepts the above format)

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Andreas Wenger
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Andreas Wenger (andi-xenoage) said :
#1

Sorry, wrong format. I think the following would be ok? (Notice that I have no "#"-codelines... Is it ok anyway?)

# translation of mainmenu.po to Deutsch
#
# Andreas Wenger <email address hidden>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: Slam Soccer 2008\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2007-08-29 22:27+0100\n"
"Last-Translator: Andreas Wenger <email address hidden>\n"
"Language-Team: Xenoage Software <email address hidden>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "menu.file.new"
msgstr "Neue Datei..."

msgid "menu.file.open"
msgstr "Datei öffnen..."

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Данило Шеган (danilo) said :
#3

Hi -- there are problems with the format you are proposing.

You are using message identifiers where we expect English strings. This means that after importing such a file, many of our existing features would be broken for you, since we'd get no string suggestions for same strings across Launchpad.

However, there are many different ways to get XML files converted to PO files, eg. using intltool or xml2po.

If you give me the layout of your XML files, I'd be able to help you more.

Revision history for this message
Andreas Wenger (andi-xenoage) said :
#4

Thanks for the information. I got even a e-mail from a Launchpad admin, Jeroen, where he explains the PO files.
It might help other newbies too, so I post his answer now:

Andi wrote:

> I thought, I can add more language templates later.
> Isn't that possible? More vocabulary may appear when the
> game grows bigger...

You can. That is no problem. It's true that a lot is not explained on our website; we rely largely on the conventions of the gettext system, and we often assume that people are already familiar with that.

Just to make sure there are no misunderstandings, allow me to go over a few of the basics.

A "template" is a file that lists only the English strings that you wish to translate. It looks just like a translation, except the "translations" of the English texts are empty strings. You can update the template later to add more strings that need translation.

You can have several templates for different parts of your program, but usually that only makes sense for very large programs. Normally you want one template. In the gettext system, a template is a Portable Object Template or POT file (e.g. "slamsoccer.pot").

Once you have your template, you can base your translation on it by copying the POT file to a PO file (e.g. "de.po" for German), editing the header, and filling out the empty translation strings. In the same way, some volunteer may come along and create a translation to, say, French (fr.po), Spanish (es.po) or Dutch (nl.po). Many programs have dozens of PO files with different translations of the same template.

As you keep extending and updating your program, you will find that some translations are no longer complete. You keep updating the template for new versions of the source code, and when you do, some of those translation files will be missing some of the new or changed strings that are introduced in the new version of the template.

This is why we usually prefer to work with a template: the template is always the first file you update when you have new strings to translate. It is always the most complete. Once you have multiple translations, it is no longer clear that the German translation is the "original." Our software will not know that, and so in the future it might pick for example the French translation as the original. It would base its import on a translation that might not be complete. With a template, it is always clear how the information travels.

Also, if somebody copies that German translation and edits it to create a French translation, it's easy to make a mistake and leave German text in the French translation. So for that reason, too, it is clearer if all translations are copied from a template, not from another translation.

But since it looks like you started out by writing just a German translation, then that file also contains all the information we need to create a template. So we can generate a template based on the translation. It's just not what we recommend for longer-term maintenance.

Revision history for this message
Andreas Wenger (andi-xenoage) said :
#5

One thing is still unclear...

I understood that I should not use IDs for the templates like "menu.file.fileopen" but English phrases like "Open file...".
But these phrases are not always "unique". For example "up" can be the caption of a button to move something up, or it can be the name of an arrow key. The translation may differ (in German we would say "hinauf" for move up, but "oben" for the arrow key).

What's the solution for this problem?

May I use phrases like: "up //key" and "up //move" and let my program delete everything starting with "//"? Or is there any other solution? Thanks!

Revision history for this message
Данило Шеган (danilo) said :
#6

You should use "message context" in cases like that, if the messages are used in different contexts (if they are used in the same context, it's fine that they'll be translated the same, so no need to put context on them).

To do that with PO files, use msgctxt keyword. See http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files for details.

Revision history for this message
Andreas Wenger (andi-xenoage) said :
#7

Thanks for the information!
(There could be a link to this website on the Translation page, which would certainly help other newbies too)

Revision history for this message
Alejandro Vidal (mancvso) said :
#8

hi there, i'm having a little issue with the templates for my files, how can i make one? and implement it?
I use both closed captions and text for an xml + HTML rendering.
More here: http://launhpad.net/ubuntu-welcome-tour
example file: http://bazaar.launchpad.net/%7Eubuntu-welcome-window-team/ubuntu-welcome-window/0.1/download/head%3A/meet_ubuntu.xml-20100202213832-j3h11w5fducqtdar-32/meet_ubuntu.xml

Revision history for this message
Jeroen T. Vermeulen (jtv) said :
#9

deal99, could you open a separate question for this please? Things get a bit confusing if you tack a new and different question onto another one.