[MTOS-translators] Polish translation - plural forms
Andrey Serebryakov
saahov at gmail.com
Tue May 6 01:53:58 PDT 2008
Hi,
When we did the translation into Russian, we had the same problem.
We've added in ru.pm this code:
sub quant {
my($handle, $num, @forms) = @_;
return $num if @forms == 0; # what should this mean?
# Note that the formatting of $num is preserved.
return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) );
# Most human languages put the number phrase before the qualified phrase.
}
sub numerate {
# return this lexical item in a form appropriate to this number
my($handle, $num, @forms) = @_;
my $s = ($num == 1);
return '' unless @forms;
return $forms[0] if $num =~ /^[02-9]*1$/;
return $forms[0] if ( @forms == 1);
return $forms[1] if $num =~ /^[02-9]*[234]$/;
return $forms[1] if ( @forms == 1);
return $forms[2];
}
In the Russian language has 3 forms:
- 1 comment -> 1 комментарий
- 2 comments -> 2 комментария
- 5 comments -> 5 комментариев
Maybe you handy this code, by Alex Demidov <http://alexd.vinf.ru>.
On Mon, May 5, 2008 at 12:13 PM, Patryk Ściborek <patryk at sciborek.com> wrote:
> Hello!
>
> I'm preparing Polish translation of MTOS. In Polish there are more than
> two forms of nouns (singular and plural). I've got a problem with
> plural form of noun - it has 2 different forms - the first one is used
> when the number ends with 2,3 or 4 (except 12,13,14) and the second one
> is used in other cases.
>
> Here is an example (look at last letter):
> 1 hour - 1 godzina (1 is usually skipped)
> 2 hours - 2 godziny
> 3 hours - 3 godziny
> 4 hours - 4 godziny
> 5 hours - 5 godzin
> 6 hours - 6 godzin
> ...
> 21 hours - 21 godzin
> 22 hours - 22 godziny
> 23 hours - 23 godziny
> 24 hours - 24 godziny
> 25 hours - 25 godzin
> 26 hours - 26 godzin
> ...
> 31 hours - 31 godzin
> 32 hours - 32 godziny
> 33 hours - 33 godziny
> 34 hours - 34 godziny
> 35 hours - 35 godzin
> ...
>
> Many different languages have similar problem. GNU gettext project made
> special functions for this. Details (including rules for many languages)
> are here:
> http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
>
> What should I do with this? Could you give me any advice?
>
> Best regards,
> Patryk Sciborek
--
Andrey Serebryakov
More information about the MTOS-translators
mailing list