Jump to content
Sign in to follow this  
lyravega

Question to the Developers

Recommended Posts

Did something change in the way that the game interprets the translate tags on the Lua files? Specificly I'm asking about the "%_t" tags. As far as I know, these tags are used as a "catchphrase" by the game code to look for a translation if I'm correct. However, I noticed that some of the lines I've written are translated even though they don't use "%_t". I guess the game uses a translation if it is available, without regarding the "%_t" but if that is the case why do we have these tags everywhere?

 

Moreover, I was wondering another thing, related to the same tags again. Before on the Lua side, I was able to do something like this and it'd get translated:

dirString = dir.name%_t

This working made me believe that translation tags were executed after the Lua was done with them, however in the Gate.lua directions now have some extra in their names. But my previous observation led me to believe that something like this would've worked

dirString = dir.name.." /*direction*/"%_t

The thing above doesn't work though. Something might've changed, or the translating part of the code doesn't like ".." perhaps, but anyway.

 

Both of my questions boil down to one thing actually. How do these tags work?

Share this post


Link to post
Share on other sites

Well, theoretically it should work. Although the "%_t" tag was never intended for dynamic strings, it was made as an attachment to static strings. (like "Hello"%_t, not as an attachment to a variable)

But, I mean, if it works, it works.

 

Could the problem with your code be that %_t has more priority than the ".." operator?

Meaning, your code implicitely gets evaluated like this?

dirString = dir.name .. (" /*direction*/"%_t )

 

The call to the translation engine would try to translate " /*direction*/", resulting in an empty string, then attach it to dir.name, which, in total, gives the untranslated dir.name?

 

But, to answer your original question:

The %_t is like a function call the string gets put into. The %_t function then tries to find a translation to the string. If none found, it strips the comment, if existing, and returns the untranslated string.

 

The comment is important for differenciating between identical strings with different meanings. (In your specific case, W - West and W - Watt)

 

Also, a string without the %_t should not get translated at all. Do you have a working minimal example to reproduce that behaviour?

Share this post


Link to post
Share on other sites
Could the problem with your code be that %_t has more priority than the ".." operator?

Meaning, your code implicitely gets evaluated like this?

dirString = dir.name .. (" /*direction*/"%_t )

 

The call to the translation engine would try to translate " /*direction*/", resulting in an empty string, then attach it to dir.name, which, in total, gives the untranslated dir.name?

 

Hmm, your explanation makes sense. I just tried a cheap trick to test it out, changed the code from

dirString = dir.name.." /*direction*/"%_t

to

dirString = (dir.name.." /*direction*/")%_t

and it works again. So you are right, %_t has a higher priority :)

 

Also, a string without the %_t should not get translated at all. Do you have a working minimal example to reproduce that behaviour?

 

In my tooltip mod, there is a line like this for example:

line.ltext = "Velocity" --lyr_nt

The Lua comment is a simple reminder for me, and it still happens without that comment. In the game, this "Velocity" string is translated. There are a few other strings that have their translations in the localization files, however they get translated without a %_t which made me curious.

 

Even if I get a vanilla "tooltipmaker.lua" and remove the individual or all %_t from the strings, they get translated. Also, thanks for explaining stuff :)

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...