Thread: Translation problems
Brought to you by:
iridium
From: Ondrej J. <ne...@po...> - 2002-05-20 18:20:31
|
Maxim, 19:37:40 20. maj 2002 (pondelok) Greetings. I recognize to make Slovak translation of phpWeather, but I have a few problems. It seems to be impossible to make proper translation of report only with existing translation array. One example for all. I want to say when report was made in Slovak language. Report bol urobeny 1 hodinu a 1 minutu dozadu. Report bol urobeny 2 hodiny a 2 minuty dozadu. Report bol urobeny 5 hodin a 5 minut dozadu. Report bol urobeny 22 hodin a 22 minut dozadu. I hope you understand where is problem. Slovak traslations of words ``hour'' and ``minute'' depends on used number. In others fields is situation similar. Should I override pw_text methods or other solution should be used? =Nepto= ____________________________________________________________________________ Ondrej 'Nepto' Jombik, http://www.nepto.sk/ ne...@at... |
From: Max H. <ma...@fl...> - 2002-05-20 18:49:12
|
Hi, > I recognize to make Slovak translation of phpWeather, but I have a > few problems. It seems to be impossible to make proper > translation of report > only with existing translation array. > > One example for all. I want to say when report was made in Slovak > language. > > Report bol urobeny 1 hodinu a 1 minutu dozadu. > Report bol urobeny 2 hodiny a 2 minuty dozadu. > Report bol urobeny 5 hodin a 5 minut dozadu. > Report bol urobeny 22 hodin a 22 minut dozadu. > > I hope you understand where is problem. Slovak traslations of words > ``hour'' and ``minute'' depends on used number. In others fields is > situation similar. > > Should I override pw_text methods or other solution should be used? Yes, just override pw_text in pw_text_xy (i don't know the code for slovak!) - we designed it to make it easy for translators to do this. Cheers, Max |
From: Martin G. <gim...@gi...> - 2002-05-20 18:57:27
|
Ondrej Jombik <ne...@po...> writes: > Maxim, 19:37:40 > 20. maj 2002 (pondelok) > Greetings. >=20 > I recognize to make Slovak translation of phpWeather, Great! > but I have a few problems. It seems to be impossible to make proper > translation of report only with existing translation array. >=20 > One example for all. I want to say when report was made in Slovak=20 > language. >=20 > Report bol urobeny 1 hodinu a 1 minutu dozadu. > Report bol urobeny 2 hodiny a 2 minuty dozadu. > Report bol urobeny 5 hodin a 5 minut dozadu. > Report bol urobeny 22 hodin a 22 minut dozadu. >=20 > I hope you understand where is problem. Slovak traslations of > words ``hour'' and ``minute'' depends on used number. In others > fields is situation similar. >=20 > Should I override pw_text methods or other solution should be used? Yes, exactly. You would simply copy the function print_pretty_time From=20pw_text.php to pw_text_sk.php and then you would be able to change how the time is formatted. You would probably have to change the $minutes =3D sprintf($this->strings['time_minutes'], $this->properties['mark_begin'], $minutes, $this->properties['mark_end']); into something like this: if ($minutes =3D=3D 1) { $minutes =3D sprintf('a %s1%s minutu dozadu', $this->properties['mark_begin'], $this->properties['mark_end']); } elseif ($minutes =3D=3D 2) { $minutes =3D sprintf('a %s2%s minuty dozadu', $this->properties['mark_begin'], $this->properties['mark_end']); } else { $minutes =3D sprintf('a %s%s%s minuty dozadu', $this->properties['mark_begin'], $minutes, $this->properties['mark_end']); } The same goes for the hours. =2D-=20 Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather =3D> Shows the current weather on your webpage. PHP Shell =3D> A telnet-connection (almost :-) in a PHP page. |
From: Ondrej J. <ne...@po...> - 2002-05-21 15:24:42
|
Maxim, 17:10:11 21. maj 2002 (utorok) Greetings. > > =09I hope you understand where is problem. Slovak traslations of > > words ``hour'' and ``minute'' depends on used number. In others > > fields is situation similar. > > =09Should I override pw_text methods or other solution should be used? > Yes, exactly. You would simply copy the function print_pretty_time > From pw_text.php to pw_text_sk.php and then you would be able to > change how the time is formatted. > [... ...] =09And what about this solution: function print_pretty_wind($wind) { extract($wind); if (! empty($meters_per_second)) { if ($meters_per_second - floor($meters_per_second) > 0) { $this->strings['meters_per_second'] =3D ' metra za sekundu'; } elseif ($meters_per_second =3D=3D 1) { $this->strings['meters_per_second'] =3D ' meter za sekundu'; } elseif ($meters_per_second =3D=3D 2 || $meters_per_second =3D=3D 3 || $meters_per_second =3D=3D 4) { $this->strings['meters_per_second'] =3D ' metre za sekundu'; } } if (! empty($miles_per_hour)) { if ($miles_per_hour =3D=3D 1) { $this->strings['miles_per_hour'] =3D ' m=ED=B5a za hodinu'; } elseif ($miles_per_hour =3D=3D 2 || $miles_per_hour =3D=3D 3 || $miles_per_hour =3D=3D 4) { $this->strings['miles_per_hour'] =3D ' m=EDle za hodinu'; } } return parent::print_pretty_wind($wind); } =09I tried it and it works. May it be? I think that parent:: calls are=20 nothing undesirable. =09=3DNepto=3D ___________________________________________________________________________= _ Ondrej 'Nepto' Jombik, http://www.nepto.sk/ nepto@atomicpile.s= k |
From: Martin G. <gim...@gi...> - 2002-05-21 16:54:20
|
Ondrej Jombik <ne...@po...> writes: > And what about this solution: There's a couple of problems, look below: =20 > function print_pretty_wind($wind) > { > extract($wind); >=20 > if (! empty($meters_per_second)) { > if ($meters_per_second - floor($meters_per_second) > 0) { > $this->strings['meters_per_second'] =3D ' metra za sekundu'; > } > elseif ($meters_per_second =3D=3D 1) { > $this->strings['meters_per_second'] =3D ' meter za sekundu'; > } The windspeed doesn't have to be a whole number of meters per hour: it's converted from a whole number of knots into meters/second and miles/hour so it will not be a whole number after the conversion. > elseif ($meters_per_second =3D=3D 2 > || $meters_per_second =3D=3D 3 > || $meters_per_second =3D=3D 4) { > $this->strings['meters_per_second'] =3D ' metre za sekundu'; > } What if the windspeed is more than 4 meters per second? Don't you miss that case? > } > if (! empty($miles_per_hour)) { > if ($miles_per_hour =3D=3D 1) { > $this->strings['miles_per_hour'] =3D ' m=ED=B5a za hodinu'; > } > elseif ($miles_per_hour =3D=3D 2 > || $miles_per_hour =3D=3D 3 > || $miles_per_hour =3D=3D 4) { > $this->strings['miles_per_hour'] =3D ' m=EDle za hodinu'; > } > } >=20 > return parent::print_pretty_wind($wind); Ahh - very clever! :-) At first I didn't understand what you were trying to do, but now I see it - pretty cool. There should probably be a little comment that explains it to others...=20 =2D-=20 Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather =3D> Shows the current weather on your webpage. PHP Shell =3D> A telnet-connection (almost :-) in a PHP page. |
From: Max H. <ma...@fl...> - 2002-05-21 20:35:38
|
> > elseif ($meters_per_second == 2 > > || $meters_per_second == 3 > > || $meters_per_second == 4) { > > $this->strings['meters_per_second'] = ' metre za sekundu'; > > } Can I suggest that you use switch {} statements instead? It might be simpler to see and understand... Max |
From: Ondrej J. <ne...@po...> - 2002-05-22 11:43:22
|
Pauli, 13:39:20 22. maj 2002 (streda) Greetings. > > function print_pretty_wind($wind) > > { > > extract($wind); > > > > if (! empty($meters_per_second)) { > > if ($meters_per_second - floor($meters_per_second) > 0) { > > $this->strings['meters_per_second'] = ' metra za sekundu'; > > } > > elseif ($meters_per_second == 1) { > > $this->strings['meters_per_second'] = ' meter za sekundu'; > > } > The windspeed doesn't have to be a whole number of meters per hour: > it's converted from a whole number of knots into meters/second and > miles/hour so it will not be a whole number after the conversion. Numbers which are not whole are handled in first 'if' case. > > elseif ($meters_per_second == 2 > > || $meters_per_second == 3 > > || $meters_per_second == 4) { > > $this->strings['meters_per_second'] = ' metre za sekundu'; > > } > What if the windspeed is more than 4 meters per second? Don't you miss > that case? No, I don't. In that case default string ($this->strings['meters_per_second']) will be used. > > return parent::print_pretty_wind($wind); > Ahh - very clever! :-) At first I didn't understand what you were trying > to do, but now I see it - pretty cool. There should probably be a little > comment that explains it to others... My goal was to avoid counting logic in pw_text_sk. This way I can only change strings accoding to Slovak grammar convetions and at the end call original method. If there is no problem with this, I will use this way also in others parts. =Nepto= ____________________________________________________________________________ Ondrej 'Nepto' Jombik, Perl CGI developer #!/usr/bin/perl -w |
From: Martin G. <gim...@gi...> - 2002-05-22 12:07:04
|
Ondrej Jombik <ne...@po...> writes: >> The windspeed doesn't have to be a whole number of meters per hour: >> it's converted from a whole number of knots into meters/second and >> miles/hour so it will not be a whole number after the conversion. >=20 > Numbers which are not whole are handled in first 'if' case. Ah, sorry! Please make sure to put plenty of comments in the final version! It's a very nice way of extending the base-class, but it's also a bit confusing at first :-) But after two or three mails I think I get it... >> What if the windspeed is more than 4 meters per second? Don't you miss >> that case? >=20 > No, I don't. In that case default string > ($this->strings['meters_per_second']) will be used. Of course, you're right. > My goal was to avoid counting logic in pw_text_sk. This way I > can only change strings accoding to Slovak grammar convetions and at > the end call original method. If there is no problem with this, I > will use this way also in others parts. No problem - I've just never thought of doing things this way, so it really confused me in the beginning. =2D-=20 Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather =3D> Shows the current weather on your webpage. PHP Shell =3D> A telnet-connection (almost :-) in a PHP page. |