Translation with PERL?

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Re: Translation with PERL?

    [email]jmckinley@netbotz.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]asu1@c-o-r-n-e-l-l.edu[/email]
    Remove dashes for address
    Spam bait: mailto:uce@ftc.gov
    A. Sinan Unur Guest

  2. Similar Questions and Discussions

    1. Position translation
      Thanks for this site, it has alot of information. I have a tag <sometag top=53 left=162> I was able to trnslate it into <input...
    2. Translation Patch?
      There are any translation patch to the 3.0 version?
    3. DCR File Translation
      Hi, I was looking at the source code of the HTML file created, when publishing my movie, and it has <OBJECT CLASSID...> What does that actually...
    4. qtvr translation
      hello, anyone knows what's the script to "translate" a qtvr panorama whit the help of a button? thanks Pim, Holland
    5. Translation
      I use the Dutch version of Elements V2 for about half a year now. Today I noticed for the first time something funny in the filter menu. Obviously...
  3. #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

  4. #3

    Default Re: Translation with PERL?

    Bart Lateur <bart.lateur@pandora.be> wrote in message news:<b1i7hv842prlkpshg45d4q1p3kap7qk3fp@4ax.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

  5. #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]scriptyrich@yahoo.co.uk[/email]
    Rich Guest

Posting Permissions

  • You may not post new threads
  • You may 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