server side translation

Game development with Board Game Arena Studio
Post Reply
User avatar
hersh
Posts: 76
Joined: 12 December 2013, 23:49

server side translation

Post 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.
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: server side translation

Post 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.
Post Reply

Return to “Developers”