Please, prevent macros from messing up textdomain
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
Please, prevent macros from messing up textdomain
While working on porting an older campaign to newer versions of wesnoth with a translator, I noticed that the translations have a serious problem when scenario code uses macros. The code within the macro gets the textdomain from the macro, not from the scenario where it is in. Example:
The first message's textdomain is
EDIT: This happens only under some unknown but replicable circumstances, see my post bellow.
Code: Select all
{IF_VAR blabla equals 3 (
[then]
[message]
speaker=Dude
message=_"Nobody farted as loud as I did. Gaze upon me with reverence!"
[/message]
[/then]
)}
[message]
speaker=Dudette
message=_"That's incredible!"
[/message]
wesnoth
and not the scenario's textdomain, so it will not be translated no matter what the campaign's translator does, while the second one will be okay. Could this be fixed, please?EDIT: This happens only under some unknown but replicable circumstances, see my post bellow.
Last edited by Dugi on October 23rd, 2014, 4:42 pm, edited 1 time in total.
Re: Please, prevent macros from messing up textdomain
Uh... huh? Are you really sure about that?
Re: Please, prevent macros from messing up textdomain
edit: Deleted. I understood the way I isolated my strings inmunize my code from that bug if is real, so nothing relevant to say
(i have absolutely all strings defined as macros and in different files from code)
(i have absolutely all strings defined as macros and in different files from code)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: Please, prevent macros from messing up textdomain
@zookeeper
Really, I tried it in a random place and it didn't cause the above mentioned problem. However, in that scenario where I was testing it, I can still replicate the problem. I have attached the two versions where the macro causes the issue and where it's not used and the problem doesn't appear.
See the dialogue that starts with sentence 'Are you the one people call Ronry?' in save files with (it comes from the campaign Swamplings), with one file a note about a change of textdomain appears, with the other it doesn't (the rest of the code is identical).
Really, I tried it in a random place and it didn't cause the above mentioned problem. However, in that scenario where I was testing it, I can still replicate the problem. I have attached the two versions where the macro causes the issue and where it's not used and the problem doesn't appear.
See the dialogue that starts with sentence 'Are you the one people call Ronry?' in save files with (it comes from the campaign Swamplings), with one file a note about a change of textdomain appears, with the other it doesn't (the rest of the code is identical).
- Attachments
-
- 02_Healer_And_Slayer.cfg
- Not using IF_VAR and the textdomain mess does not appear
- (40.21 KiB) Downloaded 260 times
-
- 02_Healer_And_Slayer.cfg
- Using IF_VAR and the textdomain mess appears
- (40.18 KiB) Downloaded 245 times
Re: Please, prevent macros from messing up textdomain
I am starting to think Dugi could be perfectly right. Using inspect on units, sides, and variables a found several textdomains that looked called by macros. I have also found a translation bug in BfW tutorialIn Bfw 1.11.19 I readed: "female^Young lady, you have 32 hitpoints and a sword. I’m fairly sure you’ll win." (so female^ indicates not translation, I guess). This message is included as macro argument in tutorail scenario, so could be related.
edit: please ignore my notepad weird characters, they are not real text displayed (but issue is about "female^")
Code: Select all
[message]
id=Delfador
message= _"female^Young lady, you have 32 hitpoints and a sword. I’m fairly sure you’ll win."
[/message]
edit: please ignore my notepad weird characters, they are not real text displayed (but issue is about "female^")
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: Please, prevent macros from messing up textdomain
female^ is a commonly used prefix in Wesnoth to designate that a string refers to a female unit. It is used for disambiguation and dropped in the translations.
Re: Please, prevent macros from messing up textdomain
May be you misundertood me, I am telling I read "female^" displayed while running game tutorial. You could check it running tutorial in BfW 1.11.19GunChleoc wrote:female^ is a commonly used prefix in Wesnoth to designate that a string refers to a female unit. It is used for disambiguation and dropped in the translations.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: Please, prevent macros from messing up textdomain
This looks like bug #22928 [Gna.org].tekelili wrote:May be you misundertood me, I am telling I read "female^" displayed while running game tutorial
Re: Please, prevent macros from messing up textdomain
You are right, I selected US English and solved translation bug in tutorial.gnombat wrote:This looks like bug #22928 [Gna.org].tekelili wrote:May be you misundertood me, I am telling I read "female^" displayed while running game tutorial
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: Please, prevent macros from messing up textdomain
Dugi: I tried to reproduce this as follows:
(1) Download swamplings from 1.10 add-on server.
(2) Copy the add-on folder into 1.12 add-ons folder
(3) Try to boot it. I get some complaints about muzzle flash miss macro or something. I fix this by deleting all [else] [/else] blocks containing the muzzle flash miss macro in Thundergobo.cfg and Vundergobo.cfg. Now it boots for me.
(4) :debug :n to scenario 02.
(5) After the text in question check logs for textdomain warnings.
(6) I didn't find any, so try again with ./wesnoth --log-info=config. Still no warnings.
I also moved this to technical support since it if text domains are broken with macros, that is a bug and not a feature request.
(1) Download swamplings from 1.10 add-on server.
(2) Copy the add-on folder into 1.12 add-ons folder
(3) Try to boot it. I get some complaints about muzzle flash miss macro or something. I fix this by deleting all [else] [/else] blocks containing the muzzle flash miss macro in Thundergobo.cfg and Vundergobo.cfg. Now it boots for me.
(4) :debug :n to scenario 02.
(5) After the text in question check logs for textdomain warnings.
(6) I didn't find any, so try again with ./wesnoth --log-info=config. Still no warnings.
I also moved this to technical support since it if text domains are broken with macros, that is a bug and not a feature request.
Re: Please, prevent macros from messing up textdomain
It shows no warnings. When it's loaded, check out the save file it generates. Find these lines and check out which textdomain it belongs to. A bit above the text, it has a line
#textdomain wesnoth-macros
. So these lines belong to a wrong textdomain and aren't translated consequently. If you are lazy to check that one, just wait, I will be releasing Swamplings updated (also with some bugfixes and such) for 1.10/1.12 soon, and it will include at least one translation to see what it produces.Re: Please, prevent macros from messing up textdomain
Ah ok, I see.
Now I can reproduce it at least
https://gist.github.com/cbeck88/454ca60 ... ave1-L7005
However that's the only place I can see that gets changes to textdomain wesnoth instead of wesnoth-swamplings. So I'm still not sure if its a bug in 1.12.0 or in swamplings.
Now I can reproduce it at least
https://gist.github.com/cbeck88/454ca60 ... ave1-L7005
However that's the only place I can see that gets changes to textdomain wesnoth instead of wesnoth-swamplings. So I'm still not sure if its a bug in 1.12.0 or in swamplings.
Re: Please, prevent macros from messing up textdomain
It happens also on 1.10, I wasn't testing this on 1.12.
It's unlikely to be a bug in Swamplings because removing the macro it's wrapped in fixes the problem and there is no other reason why should be the textdomain changed at that point.
It's unlikely to be a bug in Swamplings because removing the macro it's wrapped in fixes the problem and there is no other reason why should be the textdomain changed at that point.
Re: Please, prevent macros from messing up textdomain
Dugi:
Yeah probably it's easier for you to say because you have looked at the code for swamplings, but I haven't so I don't know.
But given the evidence you had, it seems that there's probably something wrong in the preprocessor, unless swamplings has some insane lua redefinitions of core wml tags going on or something, in which case all bets are off.
It's also pretty strange that no one else has reported this.
I think probably the best thing would be to delete all other scenarios of swamplings, delete unrelated macros etc. etc. and condense it until you get a minimal test case, then we'll really know what's going on. Or just try to make a minimal test case by hand but I guess you tried this?
Yeah probably it's easier for you to say because you have looked at the code for swamplings, but I haven't so I don't know.
But given the evidence you had, it seems that there's probably something wrong in the preprocessor, unless swamplings has some insane lua redefinitions of core wml tags going on or something, in which case all bets are off.
It's also pretty strange that no one else has reported this.
I think probably the best thing would be to delete all other scenarios of swamplings, delete unrelated macros etc. etc. and condense it until you get a minimal test case, then we'll really know what's going on. Or just try to make a minimal test case by hand but I guess you tried this?
Dugi wrote: This happens only under some unknown but replicable circumstances, see my post bellow.
Re: Please, prevent macros from messing up textdomain
Swamplings uses no lua.
I was told that somebody (maybe zookeeper, I wasn't told this exactly in that PM) is looking at it already, but I have no more information how is that going. I will ask him when I'll be on IRC (I am currently quite submerged in some physics research).
I was told that somebody (maybe zookeeper, I wasn't told this exactly in that PM) is looking at it already, but I have no more information how is that going. I will ask him when I'll be on IRC (I am currently quite submerged in some physics research).