LxCenter HyperVM & Kloxo Support

Forum



Members   Search      Help    Register    Login    Home
Home » Archive » LxAdmin » Translations » Translation problem
Translation problem [message #12536] Mon, 03 September 2007 08:22 Go to next message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
Hello,

We have fully translated version of latest lxadmin into Turkish with small problem ( in fact very very big )

Our native language does not accept simple suffixes for making a word plural..

In our language s means "ler" or "lar". It depends last vowels of word to add ler or lar.
But we have another rule.. Some root of words gets changed when a plural prefix added

Let'me give an example

Domain name (singular )
Domain names (plural ) which is enough to add an "s"

Domain name = Alan adi
Domain names != Alan adilar
Domain names = Alan adlari

I'm sure you gotcha what i mean..

at the end, can you please give up writing get_plural function and create a full translation file for everything


thanks
Re: Translation problem [message #12537 is a reply to message #12536] Mon, 03 September 2007 08:28 Go to previous messageGo to next message
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 #13476 is a reply to message #12537] Mon, 17 September 2007 07:34 Go to previous messageGo to next message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
Hello,

I'm very sory but we have a problam again...

function get_plural($word)
{
include_once "/usr/local/lxlabs/lxadmin/httpdocs/lang/tr/plural.inc";

if (in_array($word,$plural_list)) {
return $plural_list[$word];
}

return "{$word}ler";
}


and plural.inc contains

$plural_list['ticket'] = "Plural of that word";

But it never displays...
Re: Translation problem [message #13477 is a reply to message #13476] Mon, 17 September 2007 07:42 Go to previous messageGo to next message
Lxhelp
Messages: 23691
Registered: July 2006
The Champion
Make sure that the plural.inc is a proper php file with <?php at the beginnning. Also it is owned by lxlabs.lxlabs

Thanks.

Re: Translation problem [message #13483 is a reply to message #13477] Mon, 17 September 2007 07:54 Go to previous messageGo to next message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
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 #13486 is a reply to message #13483] Mon, 17 September 2007 08:07 Go to previous messageGo to next message
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 #13490 is a reply to message #13486] Mon, 17 September 2007 08:17 Go to previous messageGo to next message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
hello,

it doesn't work....

for example;

$word = "Turkish Word" (stands for 'ticket' )

while trying to search in array like below
isset($plural_list[strtolower($word)])


we are looking an array key named "turkish word", but key name is 'ticket'..

problem is this..

how can i solve?

thanks
Re: Translation problem [message #13492 is a reply to message #13490] Mon, 17 September 2007 08:20 Go to previous messageGo to next message
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 #13495 is a reply to message #13492] Mon, 17 September 2007 08:25 Go to previous messageGo to next message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
print_R prints $plural_list array.

I am still confused

$word variable which we try to find in array.

$word contais transtlated version of real word.. right?

Re: Translation problem [message #13497 is a reply to message #13495] Mon, 17 September 2007 08:29 Go to previous messageGo to next message
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.


Re: Translation problem [message #13927 is a reply to message #13497] Fri, 21 September 2007 06:21 Go to previous message
ayazici is currently offline ayazici  Turkey
Messages: 115
Registered: June 2007
Valuable Member
this never works


my langfunctionlib.php
----------------------------------
<?php

function get_plural($word)
{
include_once "/usr/local/lxlabs/lxadmin/httpdocs/lang/tr/plural.inc";

#echo "Requested word : $word\n<pre>";
#print_r($plural_list);

if (isset($plural_list[$word])) {
return $plural_list[$word];
}


return "{$word}ler";
}
?>


------------------------------------------------------------ -

my plural.inc

$plural_list['Bilgi'] = "Bilgiler";
$plural_list['Kayıt'] = "Arıza Kayıtları";
$plural_list['Mesaj'] = "Mesajlar";
$plural_list['Dosyalar'] = "Dosyalar";
$plural_list['DNS Şablonu'] = "DNS Şablonlar<C4><B1>";
$plural_list['Mysql Veri Tabanı'] = "Mysql Veri Tabanları";
$plural_list['Ssl Sertifika'] = "Ssl Sertifikaları";
.
.
.


what's wrong with this?
Previous Topic:German
Next Topic:Debugging errors
Goto Forum:
  


Current Time: Thu Jun 20 08:13:21 EDT 2013

Total time taken to generate the page: 0.01303 seconds
.:: Contact :: Home :: Privacy ::.

Click here to lend your support to: LxCenter and make a donation at www.pledgie.com !

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software