21185 Posts in 3575 Topics - by 7369 Members - Latest Member: Crocophile

Author Topic: Question to the Developers  (Read 344 times)

lyravega

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
    • Steam
Question to the Developers
« on: July 17, 2017, 01:57:44 AM »
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:
Code: [Select]
dirString = dir.name%_tThis 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
Code: [Select]
dirString = dir.name.." /*direction*/"%_tThe 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?
« Last Edit: July 17, 2017, 01:59:54 AM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates

Martin

  • Developer
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Question to the Developers
« Reply #1 on: July 31, 2017, 03:11:56 PM »
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?
Code: [Select]
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?
« Last Edit: July 31, 2017, 03:14:28 PM by Martin »

lyravega

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
    • Steam
Re: Question to the Developers
« Reply #2 on: August 02, 2017, 12:26:34 AM »
Could the problem with your code be that %_t has more priority than the ".." operator?
Meaning, your code implicitely gets evaluated like this?
Code: [Select]
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
Code: [Select]
dirString = dir.name.." /*direction*/"%_t to
Code: [Select]
dirString = (dir.name.." /*direction*/")%_tand 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:
Code: [Select]
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 :)
« Last Edit: August 02, 2017, 12:58:32 AM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates

Martin

  • Developer
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Question to the Developers
« Reply #3 on: August 25, 2017, 12:38:42 PM »
Well, thanks for reporting. I'll look into that.