سؤال

we are translating our site with Gettext, but recently we found some problems with our translate team.

we have some string like...

Hi Bob this evening you win *three* red *balloons*

and we get something like this...

sprintf("Hi %s this %s you %s %s %s %s", $name, $action, $number, $color, $object);

The problem is that our translate team don't know the variables order... and is very dificult for them to translate correctly that "encode" string, they only see in them poedit this text

Hi %s this %s you %s %s %s %s

¿How can we handle this complex strings?

هل كانت مفيدة؟

المحلول 2

Finally we found the best way for us.

We have strings like

sprintf("Hi %s this %s you %s %s %s %s", $name, $action, $number, $color, $object);

Then we can change de vars position like this

sprintf("Hi %1$s this %2$s you %3$s %4$s %5$s %6$s", $name, $action, $number, $color, $object); The translate team can change the position only changing the number

Then... the most important thing... tell to the translate team what are these variables... with a comment for gettext like...

<!-- //Hi translator... The variables are $name, $action, $number, $color, $object -->
sprintf(_('Hi %1$s this %2$s you %3$s %4$s %5$s %6$s'), $name, $action, $number, $color, $object);

Adding the option -c in xgettext line, you can put this comment INSIDE .po file, and this is the way we choice for work :)

I hope this be a great solution for you

نصائح أخرى

use poedit, which gives you an opportunity to add comments to strings.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top