I have to improvise a multi-language CGI (sorry) without template system with in Perl embedded HTML (sorry)
I "invented" my own pure Perl language templating in the following code and would be interested in feedback and suggestions.
use strict; use warnings; use Data::Dump; my $language ='de'; # cgi-par +am # $language ='fr'; # cgi-para +m my %allowed_language = map { ($_=>1) } qw/en de/ ; unless ( $allowed_language{$language} ) { my $default='en'; warn "Unknown language code '$language', falling back to '$default' +"; $language = $default; } my $ht = <<"__HTML__"; <title>@{[ text( en=>"English", de=>"Deutsch" ) ]}</title> __HTML__ print $ht; sub text { my %texts =@_; return $texts{$language}; }
Most likely reinventing the wheel ...
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to RFC: improvising multi language HTML by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |