[Resolved] Translation problem in html tooltip

Game development with Board Game Arena Studio
Post Reply
User avatar
MathCT
Posts: 97
Joined: 23 February 2021, 13:18

[Resolved] Translation problem in html tooltip

Post 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
Last edited by MathCT on 09 October 2023, 21:55, edited 7 times in total.
User avatar
MathCT
Posts: 97
Joined: 23 February 2021, 13:18

Re: Translation problem in tooltip

Post 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)
User avatar
ufm
Posts: 2039
Joined: 06 January 2017, 08:38

Re: Translation problem in html tooltip

Post by ufm »

You have to wrap the text with _(), like _(name)
User avatar
MathCT
Posts: 97
Joined: 23 February 2021, 13:18

Re: Translation problem in html tooltip

Post 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
User avatar
ufm
Posts: 2039
Joined: 06 January 2017, 08:38

Re: Translation problem in html tooltip

Post 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.
User avatar
MathCT
Posts: 97
Joined: 23 February 2021, 13:18

Re: Translation problem in html tooltip

Post by MathCT »

I finally found my error... my array in getAllDatas which was not correct
Thanks to you
Post Reply

Return to “Developers”