|Anonymous | Login | Signup for a new account||2019-07-16 15:18 PDT|
|All Projects | supertux | supertux-contrib | supertux-editor | supertux-meta|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000842||supertux||Translations||public||2011-08-27 07:37||2015-11-29 10:01|
|Target Version||Milestone 2||Fixed in Version||Milestone 2|
|Summary||0000842: SuperTux can't translate strings in user script files|
|Description||SuperTux can translate strings in a .stl file when the user provides a proper .po file for it in the same directory. SuperTux however can't translate strings inside scripts inside that .stl file.|
So something like:
(name (_ "A Loud Night"))
will translate fine. While something like:
(script "Text.set_text(translate(\"text to be translated\"));")
The reason for this is that SuperTux uses multiple dictionaries, a global one for all the SuperTux core functionality that reads from "data/locale/" and a local one that is created on each lisp::Parse(). The later one is however only used to translate (_ ...) constructs inside the lisp files, it does not handle anything else and is discarded afterwards.
A proper fix for this would be to get rid of the whole (_ ...) handling inside the lisp parser and move it out into user code where it belongs. The user code could then share a single dictionary manager with the rest of the game.
If conflicts in the strings are an issue, it might also be possible, but more complicated, to create a separate dictionary manager for each user add-on.
A further complication is that lisp::Parser() currently uses the native filesystem for it's DictionaryManager, while the global DictionaryManager one uses Physfs. So just ripping the local DictionaryManager out and replacing it with a global one doesn't work, it needs further hacking.
|Fixed in GIT revision|
|Fixed in subversion revision|
|Attached Files||stpatch-dictionary-in-world.diff [^] (13,474 bytes) 2011-08-31 02:34 [Show Content]|
Combining the Lisp and the global Dictionary would need patching tinygettext because we only have DictionaryManager::add_directory but not remove_directory which would be needed to keep the directory stack clean.
I propose keeping a second dictionary but moving it from lisp::Parser to World. Maybe I'll write a patch if i have time tonight.
|I wrote a patch moving the dictionary manager to World. I had to reorganize some things in the code. The patch solves the problem of translate() but Lisp::Parser is still involved in translating. Maybe the approach to use World as location for the DictionaryManager is just wrong.|
|So, can I translate the text if I apply the patch ???|
|Yes. But I'm pretty sure the patch isn't good. It just moves some things around and while i generally like the approach i'm not happy with the implementation in this patch. Like grumbel said, translation handling should be completely moved out of the Lisp* classes. And we could simplify it a lot by using just one dictionary, but that could lead to conflicts if levels use the same strings like the core (I don't think it would happen that much but I'm not a level designer. It's worth a discussion).|
|I added some python scripts to extract translatable strings from scripts and create a temporary file which xgettext can parse, for add-ons as well as main scripts.|
|2011-08-27 07:37||grumbel||New Issue|
|2011-08-27 10:28||user767||Note Added: 0002549|
|2011-08-31 02:33||rgcjonas||Note Added: 0002573|
|2011-08-31 02:34||rgcjonas||File Added: stpatch-dictionary-in-world.diff|
|2011-09-14 04:47||mol1||Note Added: 0002700|
|2011-09-14 06:30||rgcjonas||Note Added: 0002701|
|2012-09-08 06:22||superdev||Tag Attached: AttachedFiles|
|2014-08-18 00:59||grumbel||Relationship added||related to 0000106|
|2015-11-29 10:01||Tobbi||Status||new => resolved|
|2015-11-29 10:01||Tobbi||Resolution||open => fixed|
|2015-11-29 10:01||Tobbi||Fixed in Version||=> Milestone 2|
|2015-11-29 10:01||Tobbi||Target Version||=> Milestone 2|
|2015-11-29 10:01||Tobbi||Note Added: 0003803|
|2015-11-29 10:01||Tobbi||Assigned To||=> Tobbi|
|Copyright © 2000 - 2010 MantisBT Group|