Replacing translation funtion _ with sprintf

Game development with Board Game Arena Studio
Post Reply
User avatar
Inaofr
Posts: 142
Joined: 26 March 2020, 22:26

Replacing translation funtion _ with sprintf

Post by Inaofr »

In my old code base I have a lot of translations in php using _, which is now deprecated and according to the dry run should be replaced by clienttranslate.
As far as I know, clienttranslate does not work with sprintf, which I also have a lot. Is that still true?

If yes, it means I have a lot of refactoring to do to rely when possible on the notification arguments as explained in the wiki, but I have translated string also in getAllDatas (all the material description is generated on server side using a lot of sprintf and sent in getAllDatas). Is there some way to get read of _ in this case?
User avatar
Inaofr
Posts: 142
Joined: 26 March 2020, 22:26

Re: Replacing translation funtion _ with sprintf

Post by Inaofr »

I confirm that clienttranslate is still not working with sprintf and so is not a suitable replacement for all _ translation function on PHP side.
Also clienttranslate is not working in the deprecated *.view.php.

I had in fact no notifications to refactor, all the remaining _ were for descriptions of the material. I had to rewrote them all in the javascript file using dojo.string.substitute to replace sprintf. As a result all strings that were formatted with sprintf had to be modified to use the substitute argument syntax (${something} instead of %s or %d). So all the matching translations will have to be redone.
Post Reply

Return to “Developers”