Can add some function about grammar?

Fj

Joined: 2003-08-25
Posts: 4
Posted: Thu, 2003-08-28 21:19

In write some translations i found English and Chinese grammar have some place different like
we declear a fraction we will write numerator frist but English will say (denominator) of (numerator)
Those in /classes/Album.php , /layout/navphoto.inc , /setup/functions.inc , /slideshow.php , /slideshow_low.php can be found.
I write some code can be done this ,but i am to stupid too code... :(
i write this suck code....><"

this is in /po/zh_TW-gallery.po(ver.1.4_RC1)

#: ../classes/Album.php:214
#, php-format
msgid "0"
msgstr "1"

and this is in /classes/Album.php(ver.1.4_RC1)

if (_("0")) {print sprintf(_("Upgrading item %d of %d . . . "), $count, $i);} else {print sprintf(_("Upgrading item %d of %d . . . "), $i, $count);}

Although it can work ,but i think those are sucks code....... :(

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-08-28 21:30

Moved to translation forum

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2003-08-28 21:34

Gettext allows for you to reverse the arguments in your translation specifically to get around this problem by using dollar signs ($)
in your translation.

For example, if your translation contains:

msgid "Upgrading item %d of %d . . . "
msgstr "count: %2$d,  item: %1$d . . . "

then this code:

 $i = 3;  $count = 5;
printf(_("Upgrading item %d of %d") $i, $count))

would generate:

count: 5, item: 3

See how they're reversed?

 
Fj

Joined: 2003-08-25
Posts: 4
Posted: Fri, 2003-08-29 00:31

tks... :D
it works... :D
only the "slideshow" can't be done ,but it much beter
tks....:D

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Fri, 2003-08-29 10:36

Thanks bharat for this hint, i will add this to the howto.

Fj: i will look at the slideshow code...

Jens