Untranslatable tooltip in [Lua] ?

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

Moderators: Forum Moderators, Developers

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

Untranslatable tooltip in [Lua] ?

Post by WhiteWolf » November 24th, 2017, 3:43 pm

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?
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now published!

User avatar
tamanegi
Posts: 125
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: Untranslatable tooltip in [Lua] ?

Post by tamanegi » November 25th, 2017, 3:25 am

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 Regular
Posts: 370
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Untranslatable tooltip in [Lua] ?

Post by WhiteWolf » December 4th, 2017, 6:12 pm

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.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now published!

User avatar
tamanegi
Posts: 125
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: Untranslatable tooltip in [Lua] ?

Post by tamanegi » December 5th, 2017, 12:54 pm

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: 1198
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: Untranslatable tooltip in [Lua] ?

Post by Celtic_Minstrel » December 29th, 2017, 4:45 pm

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.
Maintainer of Steelhive.

Post Reply