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!