Mailing List Archive

multilingual site
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi all.

I'm interested in your opinions on what is the easiest and simplest
solution for multilingual site. I have searched cpan and web and found
that Locale::Maketext::Lexicon is pretty nice solution. The only thing
that I don't like in this solution is that I need do generate locales
for every language that I will be using, but other than that I think it
works file, opinions?

This is how I plan to implement it.

Hello.pm
...
package Hello::I18N;
use base 'Locale::Maketext';

use Locale::Maketext::Lexicon {

~ hr => [Gettext => 'hello_hr.mo'],
~ en => [Gettext => 'hello_en.mo'],
~ _decode => 1

};

1;
...

index.asp
...
<%

use Hello;

my $lh = Hello::I18N->get_handle('hr_HR');

print $lh->maketext("Hello world!");

%>
...

Thanks.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCY3qnOQdrQCiYGEYRAsIHAKCBkJmlae5b9WGKrU2PRAJmNfqbNQCgiO+v
JS7/q/EYpqvBcdYfaj6WrrY=
=0nVf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: multilingual site [ In reply to ]
Hi,

>
> I'm interested in your opinions on what is the easiest and simplest
> solution for multilingual site. I have searched cpan and web and found
> that Locale::Maketext::Lexicon is pretty nice solution. The only thing
> that I don't like in this solution is that I need do generate locales
> for every language that I will be using, but other than that I think it
> works file, opinions?
>

probably there are many ways to do that -
(i don't know "Locale::Maketext::Lexicon"..)

I did it by
...
my $translations_per_webpage = get_trans (language, country, page);
...
print $translation->{'hello'};
print $translation->{'good_bye'};
...

get_trans() fetches the translation items from a MySQL table and has
a fallback to a "standard" language and country (german, germany in my
case).
One can also ommit the country if the translation is not country specific,
and page if the item is not page specific.

It also returnes translations, which are common for all pages, but will be
overwritten if a specific item for a distinct page exists.


Helmut



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org