|
| Re: Translation problem [message #12537 is a reply to message #12536] |
Mon, 03 September 2007 08:28   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Write get_plural like this:
--------------
function get_plural($word)
{
include_once "lang/tr/plural.inc";
if (isset($plural_list[$word])) {
return $plural_list[$word];
}
return "{$word}s";
}
--------------
lang/tr/plural.inc will look like this:
---------------
<?php
$plural_list['domain_whatever'] = "plural of the word';
---------
This way, you get to have your own per-word plural, but saves us a huge amount of trouble, not needing to think about plurals at all.
Thanks.
|
|
|
|
|
|
| Re: Translation problem [message #13486 is a reply to message #13483] |
Mon, 17 September 2007 08:07   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Why did you use in_array? Use isset($plural_list[strtolower($word)]), that way, it is more guaranteed to work.
Thanks.
On Mon, Sep 17, 2007 at 11:54:45AM -0000, Ahmet YAZICI wrote:
>
>
> Hello,
>
> "php plural.inc" gives no syntax errors.
> all files in that folder owned by "lxlabs"
>
> I'm curious about $word is translated version of original file or name of "array key" ?
>
> thanks
|
|
|
|
| Re: Translation problem [message #13492 is a reply to message #13490] |
Mon, 17 September 2007 08:20   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
NOpe. Isset is looking for the key. The in_array is looking for the __value__ and that's why you are getting the error. Use isset. Also, try a print in the function itself and see what's the output.
print_r($plural_list);
Thanks.
|
|
|
|
| Re: Translation problem [message #13497 is a reply to message #13495] |
Mon, 17 September 2007 08:29   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
| Quote: |
> $word contais transtlated version of real word.. right?
|
Yes. Of course, you are right. The $word is the translated version. The plural_list should be an array of the form:
$plural_list['turkish version of ticket'] = 'turkish version of plural';
Thanks.
|
|
|
|