<% $text %> <%once> use Encode qw//; <%init> # Get language information from session my $lang = $m->session->{'use_site_lang'}; my $text; ($text) = $m->content =~ m{<$lang>(.+?)}s; if (!defined $text) { # no translation - fallback to english $lang = 'en'; ($text) = $m->content =~ m{(.+?)}s; } # decode back to utf8 $text = Encode::decode_utf8($text);