Page 1 of 1

server side translation

Posted: 27 April 2020, 00:39
by hersh
I did the following to support translation, but it looks like it doesn't work.

inside view.php

Code: Select all

$this->tpl['CARD_TEXT_FIELD'] = self::_( "Field: ");
inside .tpl

Code: Select all

var jstpl_card = '<div style="margin-top:10px;"><span style="font-style:italic;">{CARD_TEXT_FIELD}</span> ${fullFieldText}</div>'
when I view source in production the text is still in English.

how does server side translation work? when I look at other instances where the text is not inside in-line js it appears to add a <span> around the text. so does the translation still happen client side? is it different than explained @ http://en.doc.boardgamearena.com/Transl ... _.28PHP.29

or maybe its cause I switched languages and didn't wait enough time for bga to reflect my language preference update?

thanks.

Re: server side translation

Posted: 27 April 2020, 09:07
by sourisdudesert
Hi

At first, now we are not recommended anymore translations in the "view.php" as it can make untranslatable string appear during replays. We recommend using JS translations as much as possible.

For your specific case, this is a JS template, so you should use a JS variable (${CARD_TEXT_FIELD}) and set it on JS side.

Hope this helps.