Author Topic: Adding FULL support for other regions/country/languages  (Read 8739 times)

wout

  • Newbie
  • *
  • Posts: 9
    • View Profile
Adding FULL support for other regions/country/languages
« on: April 08, 2008, 12:31:49 pm »
Hello everyone,

I'm using lmce for about a week or so and am very pleased with it. I've been using open source software for quite some time now and would like to keep using it.  ;)

I'm from the Netherlands and faced the fact that:

- LMCE does not come with Dutch language support
- LMCE does not find my location

Because of this some of the functions of lmce are hard to get working. I had a hard time getting mythtv to work.

I would like to share my experience with other users. In my opinion the best way of doing this is to add support for my particular situation to lmce.

I've already found someone who is working on dutch language support. I will contact him to get working on this.

My question/proposition is the following:
Could we create a separate project to add support for other regions/country/languages.
I think that if we could create a project for this we could offload some of the work the "Programming Dev Wizards" are doing to less technical people (like me).
Maybe as a start we could create a web interface for translating lmce.

I could not find a similar project/initiative so if exists please direct me to it.

danielk

  • Guru
  • ****
  • Posts: 153
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #1 on: April 11, 2008, 04:45:57 pm »
Hi, any translations need to go into the DB, so you will need to coordinate with "Programming Dev Wizards" but the actual translation can of course be done independently.

To see the strings in English type this on an LMCE core:
   echo "SELECT PK_Text, Text.Description, Text_LS.Description AS TextToTranslate FROM Text, Text_LS WHERE Text_LS.FK_Language=1 AND PK_Text=FK_TEXT;" | mysql -uroot pluto_main

If you can hand the developers a text file with the PK_Text number followed by a translation of the TextToTranslate, then we can do the rest.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: Adding FULL support for other regions/country/languages
« Reply #2 on: April 12, 2008, 04:40:49 am »
Very nice Daniel!

The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

wout

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #3 on: April 14, 2008, 05:11:12 pm »
Hi, any translations need to go into the DB, so you will need to coordinate with "Programming Dev Wizards" but the actual translation can of course be done independently.

To see the strings in English type this on an LMCE core:
   echo "SELECT PK_Text, Text.Description, Text_LS.Description AS TextToTranslate FROM Text, Text_LS WHERE Text_LS.FK_Language=1 AND PK_Text=FK_TEXT;" | mysql -uroot pluto_main

If you can hand the developers a text file with the PK_Text number followed by a translation of the TextToTranslate, then we can do the rest.

I'll look in to this.... My brother in law is a php programmer. I'll se if he could create a frontend for this so other, non technical people, can participate in translating lmce.

Do you know what other parts are region specific? For example, I would like to share my mythtv settings with others in a way thats usable for non technical people.

Thanks in advance,

Wout

brsisr

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #4 on: May 02, 2008, 10:53:17 pm »
Hi All!

I tried to translate the Linux MCE to Russion , please find my scripts which perform a first automatic translation:

First script , which takes the string from DB and traslate it to russion( Every one could change this to it lamgauge):

#### Global variables
lang_id=4;
base_lang_id=1;
lang_desc='Russian';
###char_set='utf8';
###char_set='koi8r';
###char_set='cp1251';
char_set='cp866';

dbuser='odbcuser';
dbip='localhost'

#### End Global variables


### create language entry
mysql -u$dbuser -h$dbip -e "insert into  \`pluto_main\`.\`Language\` (PK_Language, Description , psc_id) values ($lang_id ,\"$lang_desc\",$lang_id );"

### clean the xisting language from DB
mysql -u$dbuser -h$dbip -e "delete from pluto_main.Text_LS where FK_Language =$lang_id;"

### Read the first string id for english language
fk_text_=`mysql -u$dbuser -h$dbip -e "SELECT FK_Text FROM pluto_main.Text_LS where FK_Text > 0 and FK_Language=$base_lang_id and Description not like '%<\%%' order by FK_Text Limit 1"`;
### clean field name
fk_text=`echo $fk_text_ | cut -f 2 -d " "`

#### do this operation for each record in DB
while [ "$fk_text" != "" ] ; do
### Read the text for string id which stored in fk_text   
   description_=`mysql -u$dbuser -h$dbip -e "select Description from pluto_main.Text_LS where FK_Text=$fk_text and FK_Language =$base_lang_id;"`
### clean field name
   description=`echo $description_ | sed  's/Description //' | sed 's/\\\n//'`;
   
   
### tralsation of the string
   description_rus=`echo $description | ./trans e2r` ;

### print for debug purpose
   echo -----------------------
   echo fk_text ::$fk_text::
   echo description::$description::
   echo description_rus::$description_rus::
   echo -----------------------

#### insert the translated string back to DB
   mysql -u$dbuser -h$dbip -e "insert into  \`pluto_main\`.\`Text_LS\` (FK_Text,FK_Language,Description) values($fk_text,$lang_id,\"$description_rus\");" --default-character-set=$char_set

### Read the next string id for english language
   fk_text_=`mysql -u$dbuser -h$dbip -e "SELECT FK_Text FROM pluto_main.Text_LS where FK_Text > $fk_text and FK_Language=$base_lang_id and Description not like '%<\%%' order by FK_Text Limit 1"`;

### clean field name
   fk_text=`echo $fk_text_ | cut -f 2 -d " "`
   
done;


The second script is a perl script which perform an automatic translation from internet ( not such good , but for first time is good enough)

Second script, name "trans":
#!/usr/bin/perl -w
 
 use WWW::Babelfish;
     # Dummy UserAgent
 use constant AGENT =>
             'Mozilla/4.73 [en] (X11; U; Linux)';
     # Supported Languages
 my @languages = qw(English French German Italian
                  Portuguese Russian Spanish);
     # Build hash that assigns language abbreviations
     # to languages (e=>English, g=>German, ...)
 foreach my $language (@languages) {
     my $initial = substr($language, 0, 1);
     $i2full{lc($initial)} = $language;
}
     # All abbreviations in one string (efgpirs)
 my $chars = join '', keys %i2full;
     # Conversion direction from the
     # command line (g2e, e2f, ...)
 my $way = shift;
 usage() unless defined $way;
 usage("Scheme $way not supported") unless
 ($from, $to) = $way =~ /^([$chars])2([$chars])$/;
     # Read in text to be translated
my $data = join '', <>;
    # Contact Babelfish
my $babel = WWW::Babelfish->new(agent => AGENT);
usage("Cannot connect to Babelfish") unless
    defined $babel;
    # Perform translation
my $transtext = $babel->translate(
    source      => $i2full{$from},
    destination => $i2full{$to},
    text        => $data
);
die("Error: " . $babel->error) unless
    defined($transtext);
print $transtext, "\n";
##################################################
sub usage {
##################################################
    my $msg = shift;
    my $prog = $0;
    print "usage: $prog ",
          "[${chars}]2[${chars}] file ...\n";
    foreach $c (sort split //, $chars) {
        print " $c: $i2full{$c}\n";
    }
    exit(1);
}




However it is not enough.The OrbiterGen could not recognize the fonts.
Anyone has an ideas where in DB , I need to update the fonts?
Even French and German , which exist in DB could not be recognized well enough.


Regards,

brsisr

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #5 on: May 02, 2008, 11:08:52 pm »
Hey wout , I forgot to explain that my scripts are support currently 6 languages :
English French German Italian Portuguese Russian Spanish

You only to modify them a little to change the language.
The translation are taken from Babelfish.
the second script I took from some Linux forum.( I am really sorry , I forgot who wrote it originally).
Dan , could you explain more what are additional changes should be done in DB in order to support additional fonts like Russian and etc.

For now it looks like only Arial font is used.

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: Adding FULL support for other regions/country/languages
« Reply #6 on: August 06, 2008, 10:00:17 pm »
nice scripts, I changed them a little for french but I still have a problem, only yahoo service work (babel make timeout) and yahoo work only for 100 query after what say that english langage doesn't work !!
I need to figure out what happened:

howto for french:
http://forum.linuxmce.org/index.php?topic=2558.30
http://www.domotiqa.com - home automation

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #7 on: August 07, 2008, 08:35:25 pm »
If anyone is interested in doing WebAdmin language translations, please PM me and I'll send you the files you need to translate. Someone i already working on a German translation right now, and it would be nice to add more, as the web admin can be very hard to navigate in an unfamiliar language

FladeX

  • Making baby steps
  • Posts: 2
  • from Russia
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #8 on: August 09, 2008, 03:06:59 pm »

#### Global variables
lang_id=4;
base_lang_id=1;
lang_desc='Russian';
###char_set='utf8';
###char_set='koi8r';
###char_set='cp1251';
char_set='cp866';

dbuser='odbcuser';
dbip='localhost'
Hi.
You have to use an utf8 or cp1251 charset to correct Russian translate. imho
...and sorry for my bad english

massabuntu

  • Veteran
  • ***
  • Posts: 97
    • View Profile
Re: Adding FULL support for other regions/country/languages
« Reply #9 on: August 29, 2008, 08:02:03 pm »
Hi, i wanna translate the gui in italian.

If i understend well, i have to translate each phrase of this output,

echo "SELECT PK_Text, Text.Description, Text_LS.Description AS TextToTranslate FROM Text, Text_LS WHERE Text_LS.FK_Language=1 AND PK_Text=FK_TEXT;" | mysql -uroot pluto_main

and then? Where i have to put it?

Thanks,
Martino.

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: Adding FULL support for other regions/country/languages
« Reply #10 on: September 08, 2008, 10:44:02 pm »
easyest way is to follow my link above, take my script (same little bit modified), create a table in language with new ID for italian, maybe 4,5... whatever... then change the langage in the script and the langage id (of the sql table)

Only one problem, with this script (yahoo translation), after 50, 100 word, the yahoo website, looks like not allowing the translation... so you have to wait for some hours then retry from the last translated word !!
http://www.domotiqa.com - home automation