Jump to content

Creating a translation using the PO Format


Bigfoot
 Share

Recommended Posts

  • Developer

In order to have a more structured way to create translations, we've implemented the standard method of translations that many applications and websites use: the PO format. This should make translations far easier to create and maintain.

To translate Don't Starve

  1. Download POEdit: http://poedit.net
  2. Open dont_starve/data/scripts/languages/strings.pot (the PO Template file) inside POEdit.
  3. Use the program to translate the game, and save it as [language].po. For example, you  save it as "italian.po"
  4. Create a new mod for your language, starting from this language template mod.
  5. Copy your .po file to your new mod.
  6. Edit modmain.lua to point at the name of your file and language code, like this:

That's it! You can also edit modinfo.lua to give your language pack a friendly name and description in the Mods menu in-game.

To update your translation after a Don't Starve update
Every update, we will update the template file to include all the new strings we've added. To edit your translation:

  1. Open your po file in POEdit.
  2. Click Catalog->Update from POT file... and select dont_starve/data/scripts/languages/strings.pot
  3. Translate the untranslated text, and save.
 
Do we support non-ASCII fonts?
At the moment, we do not support non-ASCII fonts. 
 
 
Edited by Bigfoot
  • Like 7
  • Thanks 2
Link to comment
Share on other sites

To All Translators Needing Latin Accent Characters Not Supported By The Game

I have finished updating my Alternate Fonts mod for the Winter Update. Please download the new version here:

http://forums.kleientertainment.com/downloads.php?do=file&id=17

Report any problems you encounter here:

http://forums.kleientertainment.com/showthread.php?10491-Alternate-Fonts-Mod-for-EU-Languages-v1-1-WINTER-UPDATE

Thanks!

Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]Please generate a po file from my revised master speech template. I want to experiment with makeing a po based speech mod template. Thanks!EDIT:Nevermind, just realized that all the new unused string settings are commented out and would not get processed anyways! :D

Edited by WrathOf
Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]

Um...ok....so usability question with the new po/t system....

The provided strings.pot ends up appearing as a long list of text *without* much context as to *what* they are for, especially when some speech items are purposefully vague.

Would it be possible for you to add the "notes for translators" property to each of the string values with the variable name?

For example:

Instead of:

#: STRINGS.PIG_TALK_HELP_CHOP_WOOD.1

msgid "KILL TREE!"

msgstr ""

provide this:

#. PIG_TALK_HELP_CHOP_WOOD.1

#: STRINGS.PIG_TALK_HELP_CHOP_WOOD.1

msgid "KILL TREE!"

msgstr ""

that way people can turn on the "Display Notes for Translators" window from POedit's view menu and have some idea what the phrase relates to.

Beyond that it would be *nice* if the po/t file followed the general order found in strings.lua since they is organized and grouped reasonably well.

Link to comment
Share on other sites

  • Developer

provide this:#. PIG_TALK_HELP_CHOP_WOOD.1#: STRINGS.PIG_TALK_HELP_CHOP_WOOD.1msgid "KILL TREE!"msgstr ""

Is it okay if both of them are STRINGS.PIG_TALK_HELP_CHOP_WOOD.1? Like:#. STRINGS.PIG_TALK_HELP_CHOP_WOOD.1#: STRINGS.PIG_TALK_HELP_CHOP_WOOD.1msgid "KILL TREE!"
Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]Sure, sure, I was just trying to remove unnecessary data....Actually, ideally it would be:#. STRING#. PIG_TALK_HELP_CHOP_WOOD#. 1#: STRINGS.PIG_TALK_HELP_CHOP_WOOD.1 msgid "KILL TREE!" another example:#. STRINGS#. CHARACTERS#. GENERIC#. ACTIONFAIL#. SHAVE#. GENERIC#: STRINGS.CHARACTERS.GENERIC.ACTIONFAIL.SHAVE.GENERICmsgid "I can't shave that!"msgstr ""EDIT:Regarding the order, yeah, I figured it was unintentional and maybe do to whatever recursion you were doing or something. :DEDIT2:And I swear I am not trying to be needy....just want the inexperienced translators and modders to have as much help as possible.

Edited by WrathOf
Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]

Ok...looks like we have a problem with newlines and quotes in the po files. I have reviewed the italian.po file and after correcting some syntax errors (not sure of cause yet) I was able to get his translations to show up that were not originally....

but I can't seem to get the character quote and description strings to cooperate even if I add "\\" for the "\"....

Are you evaluating/keying off of the msgid string field vs using the STRINGS.xxx id to match against?

That is all I can figure since some of these settings works and those with "\n" and "\"" do not.

Thanks

EDIT:

Typically the error in the po file looks like this....

#: STRINGS.MAXWELL_QUEST_SURVIVE.2

msgid "You better find something to eat before night comes!"

msgstr ""

"Faresti meglio a trovare qualcosa da mangiare prima che giunga la notte!"

versus the correct version

#: STRINGS.MAXWELL_QUEST_SURVIVE.2

msgid "You better find something to eat before night comes!"

msgstr "Faresti meglio a trovare qualcosa da mangiare prima che giunga la notte!"

Not sure yet if caused by the pot file or POedit.

EDIT2:

Yeah, the game is just ignoring the STRINGS.CHARACTER_QUOTES.xxxx settings in the po file or and of the STRINGS.CHARACTER_DESCRIPTIONS.xxxx ones with a newline escape character

EDIT3:

Yeah, looking at translator.lua....looks like you are ignoring the "#" lines and keying off the msgid which is eating the "\"", "\n" and "\r" escape characters in the process. :S

Is there an issue with searching for "#:" and keying off of the actual id vs the english string value in msgid?

EDIT4:

Oh and assuming you change the po importer to key off your program string ids vs the english value, make sure to force upper case the id since the po file has character names in lower case for some reason. At least I think that is an issue for Lua....

Edited by WrathOf
Link to comment
Share on other sites

  • Developer

Interesting. PO files (like gettext) and POEdit by default keys off the english msgid's, which is why I did it the same way. At least, that's my impression. Let me know if you think it really should be otherwise...Also it looks like POEdit save is causing the weirdness with the newlines. I'm looking into it.

Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]As long as they can be read in and interpreted correctly, msgid is fine. I am not experienced with the whole po and gettext business either but from a programming perspective it seems odd for the program to key off this value vs the id assigned by the programmer.I think POedit and gettext may key off those for their purposes since that is the focus at that level. I just want it to work reliably....I'll leave the how to you..."ways and and means" as the saying goes. :DEDIT:Oh, by the way, I was not using POedit but editing the itialian.po file directly and then running the game to see what I got out....tried all the variations I could think of but never got the quotes or newlines to show correctly.

Edited by WrathOf
Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]

Ok, now that this thread has been restored....the hunt for bugs shall commence!

So....POedit is popping up a warning when loading the latest strings.pot file....

"internationaization messages should not contain the '\r' excape sequence"

So consider yourself warned! :lol:

Not sure why these are in there as I don't think the text widget handles them anyways.

Other than that....it appears that the strings.lua file got adjusted for the latest hotfix but the strings.pot file did not get regenerated to get the changes....new pipeline workflow issue to iron out....yay! Darn tents anyways. :D

The new translator notes in the pot file imports fine to existing po files so looks like we are all good there. Much more sensible now.

Thanks for all the hard work!

Link to comment
Share on other sites

  • Developer

Yeah I saw those warnings, but I think everything is fine. I'll take a closer look at some point.In terms of the strings.pot not being fully updated... yeah, I haven't built the pipeline as part of the build script so it's easy to forget to update. That's on my TODO list. I'm on holiday starting next Wednesday, so we'll see how much I can get done!

Link to comment
Share on other sites

Hmm, how odd....I see what you mean.You can manually add the entries to your po file for now if you want....#. STRINGS.TABS.LIGHT#: STRINGS.TABS.LIGHTmsgid "Light"msgstr ""#. STRINGS.TABS.FARM#: STRINGS.TABS.FARMmsgid "Food"msgstr ""

Link to comment
Share on other sites

Yes, I know about this... But if only add entry:#. STRINGS.TABS.LIGHT#: STRINGS.TABS.LIGHTmsgid "Light"msgstr ""in file .po, in game this entry not work good, because the name of the tab 'Light' is the same as the actions 'Light' (arson something). Changes must be made in both files: strings.lua and .po, for example:First, in file strings.lua you need change entry:ACTIONS= LIGHT = "Light"onACTIONS= LIGHT = "Burn"(or any order, it's only a example). Secondly, in file .po you need change entry:#. STRINGS.ACTIONS.LIGHT#: STRINGS.ACTIONS.LIGHTmsgid "Light"msgstr ""on#. STRINGS.ACTIONS.LIGHT#: STRINGS.ACTIONS.LIGHTmsgid "Burn"msgstr ""and add new entry:#. STRINGS.TABS.LIGHT#: STRINGS.TABS.LIGHTmsgid "Light"msgstr ""

Link to comment
Share on other sites

  • Developer

AGH. I guess i should've known this would become a problem. Why does gnu gettext key off the text instead of keys by default?? I think I may need to switch over to keys... but then it'll break all the current PO files again :( Suggestions, folks?

Link to comment
Share on other sites

[MENTION=2]Bigfoot[/MENTION]

Um....yeah....told you so! :D

There is just sooo much text in the game that keying off of it versus the internal ids just does not make sense.

BUT this really should not be a big deal....

There is nothing wrong with having 2 po entries whose text are the same, i.e. "Light", they just have to have unique "#:" ids, not msgid's.

#. STRINGS.ACTIONS.LIGHT

#: STRINGS.ACTIONS.LIGHT

msgid "Light"

msgstr ""

#. STRINGS.TABS.LIGHT

#: STRINGS.TABS.LIGHT

msgid "Light"

msgstr ""

It should not matter what POedit keys of off as that program is focused on translating the text and when sorting the above you see 2 entries with the same text to translate....all good.

NOW....the issue is in reworking your translation script to read the "#:" lines and use it to match up with the interal STRINGS data structure. Again, should not be a big deal.

What I don't understand is what you are using to EXPORT the strings data structure to a pot file. That needs to also get adjusted to create entries for ALL strings values regardless of whether the msgid (text) is a duplicate. Are you not using a custom lua script for this export process?

If we can get the game's import/export process fixed up, all the existing po files will continue to work fine....they will just need to update them against a new pot file with *all* the strings entries.

I hope what I am saying makes sense.

EDIT:

Oh and who cares what gnu gettext chooses to key off of? Are you using it in some way?

Seems to me we should just be concerned with the po file format, not what other programs that use it are doing with them.

EDIT2:

Like I was trying to say earlier....msgid is the translator program's id to key off of so you can sort the list by it and handle all the entries with the same text at the same time.

"#:" is YOUR id keyed to how YOU manage the string data in YOUR program.

Edited by WrathOf
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...