News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Translation of UpdateEntArea captions

Started by nite_man, September 07, 2009, 12:10:18 PM

Previous topic - Next topic

nite_man

Hi,

I'm trying to make a Russian translation of LinuxMCE GUI. So, all English caption from the table Text_LS were translated and inserted into that table with new language. The item of top level menu such Light, Media, Security etc are showed on Russian. But items of menu Media - Video, Audio, Pictures etc, for example, are still in English. But I'm sure that translations of that items are exists in the Text_LS.

The same problem with Italian or German languages. Any suggestions how to solve that?

TIA
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

tschak909

Someone needs to look into UpdateEntArea to see if it's possible to use <%=Txxxx%> variable substitutions instead of the "Audio" "Videos" "Pictures" etc that currently exist in there.

If you look on the Orbiter Variables page in the wiki, you'll see that <%=Txxxx%> where xxxx is the PK_Text # of a text object in designer.

-Thom

nite_man

Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

nite_man

I dig a bit UpdateEntArea to see how to use description from the Text_LS instead of hardcoded ones. So, approach with <%=TXXXX%> actually needs function to get description for caption according to its ID. Something like that (got it from OrbiterGen/OGText.cpp):
Row_Text_LS *CGText::GetText_LS(int PK_Text,OrbiterGenerator *pOrbiterGen)
{
    Database_pluto_main *mds = pOrbiterGen->m_spDatabase_pluto_main.get();
    Row_Text_LS *pRow_Text_LS = mds->Text_LS_get()->GetRow(PK_Text,pOrbiterGen->m_pRow_Language->PK_Language_get());
    if( pRow_Text_LS==NULL )
        pRow_Text_LS=mds->Text_LS_get()->GetRow(PK_Text,0);
    if( pRow_Text_LS==NULL )
        pRow_Text_LS=mds->Text_LS_get()->GetRow(PK_Text,1);
    if( pRow_Text_LS==NULL )
    {
        LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Warning!  Text Object: %d no text",PK_Text);
        pRow_Text_LS=mds->Text_LS_get()->GetRow(TEXT_USR_ENTRY_CONST,1);  // Generic text object
    }

    return pRow_Text_LS;
}


As you may see it takes PK_Text and OrbiterGenerator as parameters. OrbiterGenerator is needed to get database handler and language ID used for the specific Orbiter. So, database handler exists in the UpdateEntArea. But I cannot find a way to get used language. Tom, maybe you can have some idea how to do that?
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

nite_man

After digging a code I found that UpdateEntArea menu items are not related with Orbiter.  Because one Orbiter can display menu for each room/EntArea. So, as a solution to have translated menu for EntArea we can do following. UpdateEntArea will build CommandGroup arrays for each language which is available in the system. And then the Orbiter will take appropriate CommandGroup according to set language. Not sure that this is effective way. But at least it should work.
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

tschak909


nite_man

Quote from: tschak909 on October 04, 2009, 04:19:02 PM
sounds okay to me.

-Thom

Or maybe it can be done by another way. Correct me if I'm wrong. All group of commands generated by UpdateEntArea are stored in the table CommandGroup. And then OrbiterGen takes them and produces the buttons. If so instead of actual description such Video or Audio we can store in that table PK_Text and retrieve appropriate description according to set language. Because inside OrbiterGen we now the what Orbiter is generated and what its language is.
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

tschak909


nite_man

I played a bit with UpdateEntArea and OrbiterGen and found the way to translate the captions. See result below:



Will open a new ticket to describe what should be change and then commit my changes if they'll be accepted.
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

nite_man

Added a new ticket regarding the subject - http://svn.linuxmce.org/trac.cgi/ticket/366

Fill free to add your ideas and suggestions :)
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

nite_man

Well, IMHO it's up to you how to translate that text. For example, in Russian we have similar words for feeds, news, peers etc. In any case, if you think that users will understand it leave those phrases in English or type them on German but without translation if it's ok.
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]