Professional Web Applications Themes

Translation with PERL? - PERL Miscellaneous

[email]jmckinleynetbotz.com[/email] (Jon) wrote in news:43e4cdd3.0307141337.18259da7 posting.google.com: > I've been using Perl for the past two years on my companies website. > I've also enlisted Embeded perl (mod_perl) which is very, very cool! > > I've been tasked with redesigning the site again and I must keep > translation in mind. I've been involved before with translating a > website that ran off JAVA, jsp pages and webshere. The translation was > done with property files holding each language as well as image urls. > My questions is can something like this be done with perl and apache. > Can a ...

  1. #1

    Default Re: Translation with PERL?

    [email]jmckinleynetbotz.com[/email] (Jon) wrote in news:43e4cdd3.0307141337.18259da7
    posting.google.com:
    > I've been using Perl for the past two years on my companies website.
    > I've also enlisted Embeded perl (mod_perl) which is very, very cool!
    >
    > I've been tasked with redesigning the site again and I must keep
    > translation in mind. I've been involved before with translating a
    > website that ran off JAVA, jsp pages and webshere. The translation was
    > done with property files holding each language as well as image urls.
    > My questions is can something like this be done with perl and apache.
    > Can a property file be just a text file that is referenced for
    > different languages?
    If you had been using ResourceBundles backed by property files, take a
    look at the Config::Properties module:

    [url]http://search.cpan.org/author/SALVA/Config-Properties-0.51/Properties.pm[/url]

    Sinan.

    --
    A. Sinan Unur
    [email]asu1c-o-r-n-e-l-l.edu[/email]
    Remove dashes for address
    Spam bait: mailto:uceftc.gov
    A. Sinan Unur Guest

  2. #2

    Default Re: Translation with PERL?

    Jon wrote:
    >The translation was
    >done with property files holding each language as well as image urls.
    >My questions is can something like this be done with perl and apache.
    >Can a property file be just a text file that is referenced for
    >different languages?
    Yes.

    As someone else pointed out, you can use modules to manipulate config
    files to load the data. I myself would take a good look at YAML, which
    provides a neat way to store perl data structures in rather plain text
    files. Or you could use tabs separated text files (or CSV), and edit the
    data in a spreadsheet like Excel.

    If this is for mod_perl, it might be interesting to cache the data in an
    itnernal global data structure (untested, but I think it should work).
    That is: violate the strict separation of data spaces between scripts on
    purpose, and use a global variable.

    You can hang whole hashes off a subkey, for example

    $text{NL}{title}

    could hold the title for Dutch... while *all* translations for Dutch
    hang under $text{NL}, which is a hash ref.

    In this case, unless you want to have to restart the server every time a
    translation changes, you should include a make-like system that check
    the date of the last update of a file, and reload the data if the data
    file had been changed. Be careful to include locking, you don't want to
    reload the same data structure in two scripts at approximately the same
    time.

    --
    Bart.
    Bart Lateur Guest

  3. #3

    Default Re: Translation with PERL?

    Bart Lateur <bart.lateurpandora.be> wrote in message news:<b1i7hv842prlkpshg45d4q1p3kap7qk3fp4ax.com>. ..
    > Jon wrote:
    >
    > >The translation was
    > >done with property files holding each language as well as image urls.
    > >My questions is can something like this be done with perl and apache.
    > >Can a property file be just a text file that is referenced for
    > >different languages?
    >
    > Yes.
    >
    > As someone else pointed out, you can use modules to manipulate config
    > files to load the data. I myself would take a good look at YAML, which
    > provides a neat way to store perl data structures in rather plain text
    > files. Or you could use tabs separated text files (or CSV), and edit the
    > data in a spreadsheet like Excel.
    >
    > If this is for mod_perl, it might be interesting to cache the data in an
    > itnernal global data structure (untested, but I think it should work).
    > That is: violate the strict separation of data spaces between scripts on
    > purpose, and use a global variable.
    >
    > You can hang whole hashes off a subkey, for example
    >
    > $text{NL}{title}
    >
    > could hold the title for Dutch... while *all* translations for Dutch
    > hang under $text{NL}, which is a hash ref.
    >
    > In this case, unless you want to have to restart the server every time a
    > translation changes, you should include a make-like system that check
    > the date of the last update of a file, and reload the data if the data
    > file had been changed. Be careful to include locking, you don't want to
    > reload the same data structure in two scripts at approximately the same
    > time.


    Very Cool Guys. Thanks. I've been looking into the Config modules,
    didn't even know they were there. Look like they'll do the job. Thanks
    again.
    Jon Guest

  4. #4

    Default Re: Translation with PERL?

    Jon wrote:
    > I've been using Perl for the past two years on my companies website.
    > I've also enlisted Embeded perl (mod_perl) which is very, very cool!
    >
    > I've been tasked with redesigning the site again and I must keep
    > translation in mind. I've been involved before with translating a
    > website that ran off JAVA, jsp pages and webshere. The translation was
    > done with property files holding each language as well as image urls.
    > My questions is can something like this be done with perl and apache.
    > Can a property file be just a text file that is referenced for
    > different languages? I'm just hoping some of you out there can give me
    > a little advice before I start this project. Any ideas or help are
    > greatly appreciated.
    >
    > Jon
    Hi Jon,

    Locale::Maketext with Locale::Maketext::Lexicon is the most sophisticated
    way to go ATM. You could then use .po[t] format files which are supported
    by translation tools such as kbabel.

    Another poster suggested something based round YAML - I like YAML, but I
    don't think YAML.pm handles utf8 encoding yet, which would probably be a
    show stopper.

    Cheers,
    --
    Rich
    [email]scriptyrichyahoo.co.uk[/email]
    Rich Guest

Similar Threads

  1. Position translation
    By Suzan in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: February 15th, 11:20 AM
  2. Translation Patch?
    By Rík_Nascimento@adobeforums.com in forum Adobe Indesign Windows
    Replies: 4
    Last Post: June 19th, 12:50 PM
  3. DCR File Translation
    By djmasala.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: October 26th, 11:09 PM
  4. qtvr translation
    By Pimbo webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 0
    Last Post: October 22nd, 08:13 AM
  5. Translation
    By Leen Koper in forum Adobe Photoshop Elements
    Replies: 11
    Last Post: July 23rd, 01:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139