Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: RFC: improvising multi language HTML (gettext)

by Anonymous Monk
on Aug 11, 2015 at 23:47 UTC ( [id://1138245]=note: print w/replies, xml ) Need Help??


in reply to RFC: improvising multi language HTML

Why not regular dictionary like gettext?

PickTheLanguage( $cgi ); ... <title>@{[ text('title') ]}</title> ... <h1>@{[ text('The Choosening') ]}</h1> sub PickTheLanguage { ... warn ... our $LANG = 'fr'; # from $query ## ensure loaded %dictionary = ( fr => { title => "French", "The C +hoosening" => "Le choisirning" } ); } sub text { $dictionary{$LANG}{"@_"} || "@_"; }
ppixregexplain.pl

Replies are listed 'Best First'.
Re^2: RFC: improvising multi language HTML (gettext)
by LanX (Saint) on Aug 12, 2015 at 11:12 UTC
    > Why not regular dictionary like gettext?

    For the same reason why I use literal strings instead of a variable which is used only once.

    The whole app is still in conception, texts and design will change often, and the form of translation isn't sure yet.

    But I already using a hash with keys for frequently used expressions.

    Transition shouldn't be to complicated later.

    > ppixregexplain.pl

    sorry?

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1138245]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-19 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found