Author Topic: Allow translators to change order of placeholders  (Read 1513 times)

GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Allow translators to change order of placeholders
« on: 16 February 2013, 19:33:45 »
I just noticed that some of my translations ended up a bit stilted when I originally translated the game about a year ago.

Is it possible to use %1s, %2s etc instead of just %s, and if not, can this be implemented? This would allow a natural word order in all translations.

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Allow translators to change order of placeholders
« Reply #1 on: 20 February 2013, 14:36:45 »
On linux you could just use "%m$s", where m is the variable position (starting with 1), e.g. "%2$s" prints the second variable as string (see 'man 3 printf' for more details). Be aware that this isn't part of any C standard, only standardized in POSIX 2001. This most likely won't work on windows when built with Visual Studio (mingw or cygwin might work).

Gettext solves this problem by using an internal printf if the native libc doesn't support it (probably just a define in libintl.h).

GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Re: Allow translators to change order of placeholders
« Reply #2 on: 20 February 2013, 15:18:12 »
So, that means unless the devs find the time to switch us to gettext, it's not doable. Do I understand this right?

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Allow translators to change order of placeholders
« Reply #3 on: 20 February 2013, 17:04:40 »
Not necessarily. They could deliver their own printf-functions just like gettext. But first of all one has to try it out on windows if it's really not working with Visual Studio.

Switching to gettext would still be a good idea for multiple reasons.

GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Re: Allow translators to change order of placeholders
« Reply #4 on: 20 February 2013, 17:19:28 »
Yes, I agree. Much better than having to rewrite printf, since gettext has already done the job. Plus the benefits of the PO format - translators could use their own translation memories, and they have a good plural system as well.

 

anything