-1

Possible Duplicate:
How can I add internationalization to my Perl script?

I have a CGI/Perl script that I want to translate to multiple languages. Texts and messages are now hardcoded into the script. What's the best and efficient solution to solve this?

I don't think that reading all texts from an external file is efficient (maybe I'm wrong?), and I don't think that making a huge array with all texts for all languages is a good idea neither.

Is there any solution that doesn't involve using modules?

Community
  • 1
  • 1
  • 1
    Reusing (well-written, widely used, tested, existing) code is A Good Thing. You shouldn't look for a solution that doesn't involve modules. – Quentin Apr 05 '12 at 16:19
  • Perl is built with modules. in particular you want to use perllocale – Ahmed Masud Apr 05 '12 at 16:21
  • Thank you all :) I'm not a very good friend of using a lot of modules in Perl scripts, but after some research I think that I'm going to add one more to mine. – Marc Robledo Apr 05 '12 at 16:26

1 Answers1

1

Here's the very short summary. You have two issues: internationalization and localization. The first makes your set up available in other languages, the second allows you to customize for different groups. Search those keywords to get the rest of the story.

If you use templates for the output, you have different templates for different languages. You have to maintain several templates now, but that means you can also localize your service much easier. You can even use templates to create the templates.

There are various modules on CPAN that do these things. Even if you don't want to use modules, you can look to them to learn about the things that you have to do. After doing that, I think you'd rather use modules instead.

brian d foy
  • 129,424
  • 31
  • 207
  • 592