Follow-up Comment #2, bug #16896 (project freeciv):

The function appears to be:


static const char *number_to_ordinal_string(int num)
{
  static char buf[16];
  char fmt[] = "(%d%s)";

  fc_assert_action(num > 0, num = (num % 10) + 10);

  if ((num % 10) == 1 && num != 11) {
    fc_snprintf(buf, sizeof(buf), fmt, num, _("st"));
  } else if ((num % 10) == 2 && num != 12) {
    fc_snprintf(buf, sizeof(buf), fmt, num, _("nd"));
  } else if ((num % 10) == 3 && num != 13) {
    fc_snprintf(buf, sizeof(buf), fmt, num, _("rd"));
  } else {
    fc_snprintf(buf, sizeof(buf), fmt, num, _("th"));
  }

  return buf;
}


It is really English-language hard-coded. At least, an easy improvement can
be done, to have string "%dst", "%dnd", "%drd", and "%dth" to translate.
However, it will not match all languages.

e.g., in French, there are 2 main forms: 1er, 2ème, 3ème, etc. Only 1 is a
special case. So, 21 will be buggy in that language anyway. I think it's the
same for Indonesian. I doubt gettext as good support to handle this
correctly.

Another approach would be to avoid the usage those strings: e.g. "rank %d/%d
players").


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?16896>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to