Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - brsisr

Pages: [1]
1
Developers / Re: Translations
« on: May 06, 2008, 08:25:32 pm »


View Profile Email Personal Message (Online)
   
   
Re: Adding FULL support for other regions/country/languages
« Reply #4 on: May 02, 2008, 01:53:17 pm »
   Reply with quoteQuote Modify messageModify Remove messageRemove
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);
}

My scripts are support currently 6 languages :
English French German Italian Portuguese Russian Spanish

You only have 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).

However it is not enough.The OrbiterGen could not recognize the fonts.I found in code that if font are not updated , the arial will be used.
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.


BTW: How could I add the scripts to the distro?

2
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.

3
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,

4
Developers / Re: GSD/Ruby Developers Conferences
« on: May 02, 2008, 10:37:43 pm »
Well, the Webcast was a success,

I had set another machine up to record here.  However, we DID have a software crash (webconferencing software DimDIm) and I didn't get a chance to reconnect the recording PC.
This is almost a 2 person job, 1 to record, and 1 to host.


Hi Dan!
where could I find the record of thsi video converence,
thanks in advance

5
Developers / Re: Developer FAQ
« on: May 02, 2008, 10:30:21 pm »
Hi ,
I am new in Linux MCE.
I bouth the x-10 controller cm19a , which is not supported by the Linux MCE.
I decided to develop for it new device template.
Following the problem which I found :
1) The page which describes how to configure a new device template is different that I have in linux mce:
http://wiki.linuxmce.org/index.php/Image:EditDeviceTemplate.jpg#filehistory
2) When I try to edit a Ruby code , the web asks from me to create the new new group for my device and after this failed with message :
  Fatal error: mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1] in EXECUTE("SELECT FK_Command,PK_InfraredGroup_Command FROM InfraredGroup_Command WHERE FK_InfraredGroup= ") in /var/www/pluto-admin/include/adodb/adodb-errorhandler.inc.php on line 77

Could some one to help me and provide the explanation how to create a new device template?
Any ideas where to find the manual ?

Thanks :)

Pages: [1]