1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
//===============================
// unit tests dgettext
// INRIA 2008
// @author Sylvestre LEDRU
//===============================
// Void call
if execstr('dgettext()','errcatch')==0 then bugmes();quit;end
// one input argument
str1="plop"; if execstr('dgettext(str1)','errcatch')==0 then bugmes();quit;end
// three input argument
str1="plop"; str2="plip"; str3="plup"; if execstr('gettext(str1, str2, str3)','errcatch')==0 then bugmes();quit;end
// Try to translate from en_US to en_US to domain/string which doesn't exist
lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// Try to translate from en_US to fr_FR to a domain/string which doesn't exist
lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Localization does not exist"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// Check if it is working with a good domain & good msgid
lang="fr_FR"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation:" then bugmes();quit;end
// Check if it is working with a bad domain & good msgid
lang="fr_FR"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation:" then bugmes();quit;end
// Check if it is working with a good domain & good msgid and alias
lang="fr"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> "Initialisation:" then bugmes();quit;end
// Check if it is working with a bad domain & good msgid and alias
lang="fr"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) == "Initialisation:" then bugmes();quit;end
// Check if it is working with a good domain & good msgid
lang="en_US"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// Check if it is working with a bad domain & good msgid
lang="en_US"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// Check if it is working with a good domain & good msgid and alias
lang="en"; setlanguage(lang); domain="scilab"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// Check if it is working with a bad domain & good msgid and alias
lang="en"; setlanguage(lang); domain="fake_domain"; msg="Startup execution:"; if dgettext(domain,msg) <> msg then bugmes();quit;end
// @TODO :
// Add test to use other domain which are working (ie not fake_domain)
|