I am trying to track down some translation issues in my Pedro game (bug 30425). However, when I create a game via Express Start in my development area the game doesn't appear to do any localization. I am using the Chrome Locale Switcher plugin to adjust my locale to nl_NL and can see this being sent as the accept-language in the HTTP request... but the pages and all content from the studio.boardgamearena.com site come back as English. Is translation testing possible in the dev environment?
How do developers test alternate languages?
Re: How do developers test alternate languages?
Yes, you have a "Display dummy translations" button on the manage game page for your project.
Re: How do developers test alternate languages?
"Display Dummy Translations" is helpful, but doesn't seem to cover all the potential scenarios where bugs can be introduced. It seems like this feature only shows if you have marked a block of text for translation prep... not if you have properly called all the JS/PHP code to make the translation actually appear as-intended in the game. In my situation I believe I need to add some _() wrappers on the JS side in order to resolve the parts of the translations that are missing in the bug report. However, I would like to test this out in the Development system in order to ensure my fix works as intended (and also to reproduce the bug report for my own informational purposes). If "Display Dummy Translations" is all that is currently available then I'll try to guess as best I can based on what I think is going wrong... but I was hoping for a way to actually see the true translated content in my Dev environment so I can be sure.
Re: How do developers test alternate languages?
I checked some of your translations:
You should do:
You
- Sometimes you concatenate strings, which doesn't work with the translation system.
- I didn't try it, but you use ucfirst on some translatable strings, it may (or not) cause problem. Since I didn't see a case where you use your suit names without a first letter cap, I would just change the strings. That may be the reason why you suits names aren't translated.
- If you want a plural variation for your suits names, you should create new strings with the plural form. Some languages may not simply add a final s for the plural form.
- In many place where you use "getSuitName", you forgot to add i18n with the arg name
Code: Select all
$point_value_display = '';
if($point_value_played > 0){
$point_value_display .= clienttranslate(' (worth ') . $point_value_played . ($point_value_played == 1 ? clienttranslate(' point') : clienttranslate(' points'));
if(self::isOffsuitPedeForTrump($current_card, $current_trump_color)){
$point_value_display .= clienttranslate(' - and counts as a trump card for this hand!');
}
$point_value_display .= ')';
}
Code: Select all
if($point_value_played > 0){
if(self::isOffsuitPedeForTrump($current_card, $current_trump_color)){
$point_value_display = clienttranslate(' (worth ${points} point(s) - and counts as a trump card for this hand!)');
}else{
$point_value_display = clienttranslate(' (worth ${points} point(s))');
}
}
[...]
// Notify of card played
self::notifyAllPlayers('playCard', clienttranslate('${player_name} plays the ${value_displayed} of <span class="suit${color_displayed}"> ${color_displayed}</span>${point_value}'), array (
'i18n' => array ('color_displayed','value_displayed', 'point_value' ),
'card_id' => $card_id,
'player_id' => $player_id,
'player_name' => self::getActivePlayerName(),
'value' => $current_card ['type_arg'],
'value_displayed' => $this->values_label [$current_card ['type_arg']],
'point_value' => [
'log' => $point_value_display,
'args' => [
'points'=> $point_value_played
]
],
'color' => $current_card ['type'],
'trump_suit' => $trump_suit,
'color_displayed' => ucfirst ($this->colors [$current_card ['type']]['name']) . 's' // This is incorrect also...
));
Re: How do developers test alternate languages?
"Display Dummy Translations" generates a dummy translation for each translatable string. So it is actually exactly the same as importing the strings translated in production (which would be cumbersome as it's another environment). In any case, "Display Dummy Translations" should cover all cases inside your game; if some text is not translated with a dummy translation, there is an issue and it won't be translated too in prod (thanks @Benoit314 for looking and providing some hints!)
NB: the only case not covered on the studio with "Display Dummy Translations" is for content outside the game (gameoptions files, that is displayed in the lobby, not in the game)
Re: How do developers test alternate languages?
I see my confusion now. I was seeing log messages wrapped in the <<brackets>> and thinking that this was good from a translation perspective: https://postimg.cc/bSQycwHj
But now I understand that individual subsections that are replaced via i18n args should show as nested <<var>> sections within the outer brackets. I'll refactor to fix the issues @Benoit314 mentioned and will retest with this in mind.
Thanks for the pointers and the assistance @Een and @Beniot314!
But now I understand that individual subsections that are replaced via i18n args should show as nested <<var>> sections within the outer brackets. I'll refactor to fix the issues @Benoit314 mentioned and will retest with this in mind.
Thanks for the pointers and the assistance @Een and @Beniot314!
Re: How do developers test alternate languages?
One thing I did during the development of a Hungarian game was hijack the _ function locally by calling this in setup:
This allowed me to test that I was getting everything translated properly (on the JS side, at least), and got the Hungarian translation on point so I could enter it in the main site's translation system as soon as things went live.
Code: Select all
// HACK to force translation to Hungarian. REMOVE BEFORE PUBLISHING
hackTranslation__MAGIC: function() {
window.HACK__old_translation_function = window._;
window._ = function(message) {
switch (message) {
case 'Three':
return 'Három';
// and so on for pages and pages, until finally:
default:
return window.HACK__old_translation_function(message);
}
}
},