how to get untranslated string

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

how to get untranslated string

Post by gfgtdf »

i have a translatable string object and i wonder how to get the untranslated string behind it.
does anyone know how to do that?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: how to get untranslated string

Post by Anonymissimus »

Calling tostring() on it always automatically translates it by calling the impl_tstring_tostring metamethod. In case the language setting is "American English" it should stay the same then as that's the language the strings should be in. There's no way to enforce this or to know whether it is the case.
Perhaps you should seriously ask yourself why you feel the need to do this ? Where does the string come from ? In case it is from your code you should have the answer yourself; in case it's not, it comes somewhere from core or the engine, in which case there should be a better alternative (such as unit ids for unit names etc).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: how to get untranslated string

Post by gfgtdf »

the string comes from different sources, (from me aswell as from the core).
and i want this for my serialize function, if i replace a string by its translation that would ofc remove the translatability.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: how to get untranslated string

Post by AI »

I just took a look at src/scripting/lua.cpp, and there is no mention of the base_str() method of t_string, so you cannot retrieve the untranslated version.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: how to get untranslated string

Post by gfgtdf »

ty for this info. i guess i'll have to drop translatability for savegames, make a complicated workaround, or use wesnoth.set_variable if the containing table is a valid wml table.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Post Reply