Untranslatable tooltip in [Lua] ?

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

Moderator: Forum Moderators

Post Reply
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Untranslatable tooltip in [Lua] ?

Post by WhiteWolf »

Hi,

There was some time ago a post (I can no longer find it, was it deleted?) about how to create new unit status tooltips and get to show them with this code:

Code: Select all

[lua]
    	    code=<<
    	        local _ = wesnoth.textdomain "trs"
    	        local old_unit_status = wesnoth.theme_items.unit_status
    	        function wesnoth.theme_items.unit_status()
    	            local u = wesnoth.get_displayed_unit()
    	            if not u then return {} end
    	            local s = old_unit_status()
    	            if u.variables.poisoned then
    	                table.insert(s, { "element", {
    	                    image = "misc/bleeding.png",
    	                    tooltip = _ "bleeding: This unit is bleeding out. It loses 4 HP every turn until it is healed or dies."
    	                } })
    	            end
    	            return s
    	        end
    	    >>
    	[/lua]
I've only copied the code, I don't quite understand Lua.
My problem is, that when I try to translate the UMC, the tooltip doesn't show in the translated language, even though it is marked translatable in the code.
Any workaround for this, or what am I doing wrong?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
tamanegi
Posts: 161
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: Untranslatable tooltip in [Lua] ?

Post by tamanegi »

Code: Select all

local _ = wesnoth.textdomain "trs"
I guess textdomain of your campaign is "wesnoth-trs", not "trs". ;)
Discord: @tamanegi
It is true that we cannot be free from bugs, but at least let our bugs not always the same...
A Group in a War: my first campaign, An Independence War: and the sequel
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Untranslatable tooltip in [Lua] ?

Post by WhiteWolf »

Sorry for answering late.
It doesn't solve it :/
I rewrote the line to

Code: Select all

local _ = wesnoth.textdomain "wesnoth-trs"
which really is the textdomain btw, so it really was a bug, but still the tooltips don't show translated.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
tamanegi
Posts: 161
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: Untranslatable tooltip in [Lua] ?

Post by tamanegi »

You are right. Tooltips cannot be translated.
There maybe something wrong in the engine. :cry:

I also checked this issue in my campaigns (An Independence War for BfW 1.12 and A Group in a War for BfW 1.13), where wesnoth.theme_items are modified. The situation is completely the same as your one. Considering the fact that non-tooltip text can be translated, there maybe a translation problem specific to tooltips in wesnoth.theme_items.
Discord: @tamanegi
It is true that we cannot be free from bugs, but at least let our bugs not always the same...
A Group in a War: my first campaign, An Independence War: and the sequel
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Untranslatable tooltip in [Lua] ?

Post by Celtic_Minstrel »

For the record, I think the original post about how to do this was moved to the Wiki somewhere in LuaWML or one of its subpages.

Back on topic, it seems kind of incredible that the tooltips would literally not support translations. In particular, surely all the built-in tooltips are translated? If those work, I don't see why custom ones wouldn't work. Have you verified that your translation pipeline is correct, that the English string appears in the pot-file, and that it has been translated in the po-file?
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply