Re: [Tuxpaint-i18n] Some strings not translating (website)
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: F W. <fr...@tr...> - 2008-12-22 20:09:27
|
On Ma, 2008-12-22 at 20:03 +0100, Pere Pujal i Carabantes wrote: > > Aproximately something like this?: > > /*This string and the following will be concatenated*/ > $pict_text=sprintf(ngettext('The following is a gallery of %1$d > picture ','The following is a gallery of %1$d pictures ',$num_picts), > $num_picts); > > /*This string and the preceding will be concatenated*/ > $child_text=sprintf(ngettext('drawn by %1$d child around the world > using Tux Paint:','drawn by %1$d children (and adults) around the > world using Tux Paint:',$num_artists),$num_artists); > > /*Here you can swap the two preceding strings*/ > echo sprintf(gettext('%1$s%2$s'), $pict_text, $child_text); > > This adds a lot of complexity... You are correct - it does add complexity. We'll have to decide if it is worth it. Your example creates other problems though. The variables can't be repositioned easily. Concatenated strings are often very hard to translate. If we want to support both variables properly, something like this might work: /*This string will be substituted into the following one*/ $pict_text=sprintf(ngettext('%1$d picture','%1$d pictures', num_picts), $num_picts); /*The first variable is text like '5 pictures' from the previous string*/ echo sprintf(ngettext('The following is a gallery of %1$s drawn by %2$d child around the world using Tux Paint:','The following is a gallery of %1$s drawn by %2$d children around the world using Tux Paint:',$num_artists), $pict_text, $num_artists); I'm guess this still doesn't solve it for all languages. I foresee that the translation of "drawn" might be dependent on the number of pictures. The easy way out is to not construct a sentence, but do something more similar to "headings", or to use two separate sentences: Gallery statistics: x pictures y children or The gallery contains X pictures. Y children contributed pictures to the gallery. If we really want to support all languages, it is a bit harder :-) Keep well Friedel -- Recently on my blog: http://translate.org.za/blogs/friedel/en/content/re-bringing-all-translation-management-tools-together |