1use strict; 2use Test::More; 3use FindBin qw($Bin); 4 5use Locale::Maketext::Simple ( 6 Path => "$Bin/po_with_i_default", 7 Style => "gettext", 8); 9 10eval { 11 require Locale::Maketext::Lexicon; 12 die unless Locale::Maketext::Lexicon->VERSION(0.20); 13 require File::Spec; 14}; 15if ($@) { 16 plan skip_all => 'No soft dependencies, i_default will not work'; 17 exit 0; 18} 19 20plan tests => 6; 21 22loc_lang("en"); 23is(loc("Not a lexicon key"), "Not a lexicon key", "Not a lexicon key"); 24is(loc("I have got %1 alerts", "hot"), "Maybe it's because I'm a hot Londoner, that I love London tawn", "Got auto key" ); 25is(loc("I have acknowledged %1 alerts", 83), "Yo dude, I've been working on these 83 alerts", "Got translation still in en"); 26is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Used i_default because not set in en"); 27 28loc_lang("fr"); 29is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Translated from i_default"); 30is(loc("I have got %1 alerts", "red"), "Mon Francais red, c'est terrible", "French translated" ); 31 32