Please, prevent macros from messing up textdomain

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:
User avatar
Dugi
Posts: 4931
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Please, prevent macros from messing up textdomain

Post by Dugi » October 23rd, 2014, 11:36 am

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:

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]
The first message's textdomain is 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.

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Please, prevent macros from messing up textdomain

Post by zookeeper » October 23rd, 2014, 11:48 am

Uh... huh? Are you really sure about that?

User avatar
tekelili
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: Please, prevent macros from messing up textdomain

Post by tekelili » October 23rd, 2014, 1:14 pm

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)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II

User avatar
Dugi
Posts: 4931
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Please, prevent macros from messing up textdomain

Post by Dugi » October 23rd, 2014, 4:18 pm

@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).
Attachments
02_Healer_And_Slayer.cfg
Not using IF_VAR and the textdomain mess does not appear
(40.21 KiB) Downloaded 184 times
02_Healer_And_Slayer.cfg
Using IF_VAR and the textdomain mess appears
(40.18 KiB) Downloaded 168 times

User avatar
tekelili
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: Please, prevent macros from messing up textdomain

Post by tekelili » November 14th, 2014, 8:22 am

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 tutorial

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]
In 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 :oops: (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

User avatar
GunChleoc
Translator
Posts: 476
Joined: September 28th, 2012, 7:35 am
Contact:

Re: Please, prevent macros from messing up textdomain

Post by GunChleoc » November 14th, 2014, 9:23 am

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.

User avatar
tekelili
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: Please, prevent macros from messing up textdomain

Post by tekelili » November 14th, 2014, 9:29 am

GunChleoc 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.
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.19
tutorial_translation_bug.png
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II

gnombat
Posts: 246
Joined: June 10th, 2010, 8:49 pm
Contact:

Re: Please, prevent macros from messing up textdomain

Post by gnombat » November 14th, 2014, 12:28 pm

tekelili wrote:May be you misundertood me, I am telling I read "female^" displayed while running game tutorial
This looks like bug #22928 [Gna.org].

User avatar
tekelili
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: Please, prevent macros from messing up textdomain

Post by tekelili » November 14th, 2014, 12:46 pm

gnombat wrote:
tekelili wrote:May be you misundertood me, I am telling I read "female^" displayed while running game tutorial
This looks like bug #22928 [Gna.org].
You are right, I selected US English and solved translation bug in 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

User avatar
iceiceice
Developer
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Please, prevent macros from messing up textdomain

Post by iceiceice » November 15th, 2014, 7:06 pm

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.

User avatar
Dugi
Posts: 4931
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Please, prevent macros from messing up textdomain

Post by Dugi » November 15th, 2014, 7:41 pm

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.

User avatar
iceiceice
Developer
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Please, prevent macros from messing up textdomain

Post by iceiceice » November 15th, 2014, 10:22 pm

Ah ok, I see.

Now I can reproduce it at least :augh:

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.

User avatar
Dugi
Posts: 4931
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Please, prevent macros from messing up textdomain

Post by Dugi » November 15th, 2014, 10:31 pm

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.

User avatar
iceiceice
Developer
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Please, prevent macros from messing up textdomain

Post by iceiceice » November 15th, 2014, 10:46 pm

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?
Dugi wrote: This happens only under some unknown but replicable circumstances, see my post bellow.

User avatar
Dugi
Posts: 4931
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Please, prevent macros from messing up textdomain

Post by Dugi » November 15th, 2014, 11:06 pm

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).

Post Reply