lyravega Posted July 16, 2017 Share Posted July 16, 2017 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? Link to comment Share on other sites More sharing options...
Martin Posted July 31, 2017 Share Posted July 31, 2017 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? Link to comment Share on other sites More sharing options...
lyravega Posted August 1, 2017 Author Share Posted August 1, 2017 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 :) Link to comment Share on other sites More sharing options...
Martin Posted August 25, 2017 Share Posted August 25, 2017 Well, thanks for reporting. I'll look into that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now