Page 1 of 1

[Resolved] Translation problem in html tooltip

Posted: 07 October 2023, 18:42
by MathCT
Hello developers,

I have a small translation problem on a html tooltip
I retrieve the text from Material.inc.php via getAllDatas and then in my JS I retrieve it and inject it into my tooltip. My name is present in the tooltip but remains in English, the translation set up does not apply. I must be missing something (I simplified the code to see better):

Code: Select all

var name = _(this.gamedatas.biomename[name]);
var html = '<div class="tooltip">'+this.format_block('jstpl_biometool',{name: name})+'</div>';
this.addTooltipHtml( 'biome_'+id, html,1000);
In material.inc.php I have in the array associated with my card:

Code: Select all

'name' => clienttranslate("englishname"),
I follow the method described in the "Access" section: https://studio.boardgamearena.com/doc/G ... al.inc.php

Thanks in advance

Re: Translation problem in tooltip

Posted: 07 October 2023, 18:49
by MathCT
FYI: I use an html tooltip because in addition to the name there is the image of my card (I simplified the code for my help request)

Re: Translation problem in html tooltip

Posted: 08 October 2023, 04:31
by ufm
You have to wrap the text with _(), like _(name)

Re: Translation problem in html tooltip

Posted: 08 October 2023, 09:21
by MathCT
ufm wrote: 08 October 2023, 04:31 You have to wrap the text with _(), like _(name)
at what level?

what I have done here is of no use (is not enough)?
var name = _(this.gamedatas.biomename[name]);
thank you in advance for your help

Re: Translation problem in html tooltip

Posted: 09 October 2023, 12:58
by ufm
MathCT wrote: 08 October 2023, 09:21
ufm wrote: 08 October 2023, 04:31 You have to wrap the text with _(), like _(name)
at what level?

what I have done here is of no use (is not enough)?
var name = _(this.gamedatas.biomename[name]);
thank you in advance for your help
It should work. As far as I can check, the current version didn't wrap the name in _() yet.

Re: Translation problem in html tooltip

Posted: 09 October 2023, 21:55
by MathCT
I finally found my error... my array in getAllDatas which was not correct
Thanks to you