Bad strings i18n
-
Hi @davidanderson,
This coded string is a hardcoded concatenation that don’t allow a good translation in languages where the concatenation would need to work differently.
<?php _e('You are currently using', 'two-factor-authentication'); ?> <?php print strtoupper($algorithm_type).', '.($algorithm_type == 'totp' ? __('a time based', 'two-factor-authentication') : __('an event based', 'two-factor-authentication')); ?> <?php _e('algorithm', 'two-factor-authentication'); ?>.
The current concatenation:
“You are currently using” + ” ” + algorithm_type + “, ” + [“a time based”|”an event based”] + “algoritm” + “.”It could be changed to 3 strings:
“You are currently using %s, %s.” – %s being [“a time based algorithm”|”an event based algorithm”].But given the complexity of the string and the confusion of the second half of it, probably the best solution would be no concatenation at all, and no variables, just two very similar simple strings:
– “You are currently using TOTP, a time based algorithm.”
– “You are currently using HOTP, an event based algorithm”.This would reduce the complexity and a total of 4 translations strings to 2 with perfect i18n.
Regards
The page I need help with: [log in to see the link]
- The topic ‘Bad strings i18n’ is closed to new replies.