#!/usr/bin/env perl use strict; use warnings; use utf8; # italian in code package MyApp::I18N::en; use base 'Locale::Maketext'; our %Lexicon; $Lexicon{'There are [_1] people'} = 'There are [_1] people'; package MyApp::I18N::it; use base 'Locale::Maketext'; our %Lexicon; $Lexicon{'There are [_1] people'} = sub { my $how_many = $_[1]; return "Non c'è nessuno" unless $how_many; return "C'è una persona" if $how_many == 1; return "Ci sono $how_many persone"; }; package main; my $lang_it = MyApp::I18N::it->new; my $lang_en = MyApp::I18N::en->new; sub do_it_en { print "IT: ", $lang_it->maketext(@_), "\n"; print "EN: ", $lang_en->maketext(@_), "\n"; } for my $people (0..5) { do_it_en('There are [_1] people',$people); }