| 1 | package Log::Funlog::Lang; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | =head1 NAME | ||||||||||||||
| 4 | |||||||||||||||
| 5 | Log::Funlog::Lang - Language pack for Log::Funlog | ||||||||||||||
| 6 | |||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||
| 8 | |||||||||||||||
| 9 | use Log::Funlog::Lang; | ||||||||||||||
| 10 | my @res=Log::Funlog::Lang->new( language ); | ||||||||||||||
| 11 | my @texts=@{ $res[1] }; | ||||||||||||||
| 12 | my $language_given=$res[0]; | ||||||||||||||
| 13 | |||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||
| 15 | |||||||||||||||
| 16 | This is a perl module used by B<Log::Funlog> to obtain a list of funny things in the language of the user. | ||||||||||||||
| 17 | |||||||||||||||
| 18 | =head1 OPTIONS | ||||||||||||||
| 19 | |||||||||||||||
| 20 | B<Log::Funlog::Lang> try to determinate the language of the user by parsing LC_MESSAGES and LANG. If it doesn't find any infos in these environment variable, it use 'en' | ||||||||||||||
| 21 | |||||||||||||||
| 22 | If it occurs, you must specify the language by the widely used two letters (fr, en, ...) | ||||||||||||||
| 23 | |||||||||||||||
| 24 | =over | ||||||||||||||
| 25 | |||||||||||||||
| 26 | =item B<language> | ||||||||||||||
| 27 | |||||||||||||||
| 28 | Two-letters code specifying language to use. | ||||||||||||||
| 29 | |||||||||||||||
| 30 | Available languages are: fr, en | ||||||||||||||
| 31 | |||||||||||||||
| 32 | Default to 'en'. | ||||||||||||||
| 33 | |||||||||||||||
| 34 | =back | ||||||||||||||
| 35 | |||||||||||||||
| 36 | =head1 AUTHOR | ||||||||||||||
| 37 | |||||||||||||||
| 38 | Gabriel Guillon, from Chashew team | ||||||||||||||
| 39 | |||||||||||||||
| 40 | korsani-spam@free-spam.fr-spam | ||||||||||||||
| 41 | |||||||||||||||
| 42 | (remove you-know-what :) | ||||||||||||||
| 43 | |||||||||||||||
| 44 | =head1 LICENCE | ||||||||||||||
| 45 | |||||||||||||||
| 46 | As Perl itself. | ||||||||||||||
| 47 | |||||||||||||||
| 48 | Let me know if you have added some features, or removed some bugs ;) | ||||||||||||||
| 49 | |||||||||||||||
| 50 | =cut | ||||||||||||||
| 51 | |||||||||||||||
| 52 | 1 | ▶ | BEGIN { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 53 | 1 | ▶ | use Exporter; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 54 | 1 | @ISA=qw(Exporter); | |||||||||||||
| 55 | 1 | @EXPORT=qw(); | |||||||||||||
| 56 | 1 | $VERSION='0.4'; | |||||||||||||
| 57 | } | ||||||||||||||
| 58 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 59 | 1 | ▶ | use Carp; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 60 | 1 | my @fun; | |||||||||||||
| 61 | 1 | my %fun=( | |||||||||||||
| 62 | 'fr' => ["-- this line will never be written --", | ||||||||||||||
| 63 | "Pfiou... marre de logger, moi", | ||||||||||||||
| 64 | "J'ai faim!", | ||||||||||||||
| 65 | "Je veux faire pipi!", | ||||||||||||||
| 66 | "Dis, t'as pensé à manger?", | ||||||||||||||
| 67 | "Fait froid dans ce process, non?", | ||||||||||||||
| 68 | "Fait quel temps, dehors?", | ||||||||||||||
| 69 | "Aller, pastis time!", | ||||||||||||||
| 70 | "Je crois que je suis malade...", | ||||||||||||||
| 71 | "Dis, tu peux me choper un sandwich?", | ||||||||||||||
| 72 | "On se fait une toile?", | ||||||||||||||
| 73 | "Aller, décolle un peu de l'écran", | ||||||||||||||
| 74 | "Tu fais quoi ce soir, toi?", | ||||||||||||||
| 75 | "On va en boîte?", | ||||||||||||||
| 76 | "Pousse-toi un peu, je vois rien", | ||||||||||||||
| 77 | "Vivement les vacances...", | ||||||||||||||
| 78 | "Mince, j'ai pas prévenu ma femme que je finissais tard...", | ||||||||||||||
| 79 | "Il est chouette ton projet?", | ||||||||||||||
| 80 | "Bon, il est bientôt fini, ce process??", | ||||||||||||||
| 81 | "Je m'ennuie...", | ||||||||||||||
| 82 | "Tu peux me mettre la télé?", | ||||||||||||||
| 83 | "Y a quoi ce soir?", | ||||||||||||||
| 84 | "J'irais bien faire un tour à Pigalle, moi.", | ||||||||||||||
| 85 | "Et si je formattais le disque?", | ||||||||||||||
| 86 | "J'me ferais bien le tour du monde...", | ||||||||||||||
| 87 | "Je crois que je suis homosexuel...", | ||||||||||||||
| 88 | "Bon, je m'en vais, j'ai des choses à faire.", | ||||||||||||||
| 89 | "Et si je changeais de taf? OS, c'est mieux que script, non?", | ||||||||||||||
| 90 | "J'ai froid!", | ||||||||||||||
| 91 | "J'ai chaud!", | ||||||||||||||
| 92 | "Tu me prend un café?", | ||||||||||||||
| 93 | "T'es plutôt chien ou chat, toi?", | ||||||||||||||
| 94 | "Je crois que je vais aller voir un psy...", | ||||||||||||||
| 95 | "Tiens, 'longtemps que j'ai pas eu de news de ma soeur!", | ||||||||||||||
| 96 | "Comment vont tes parents?", | ||||||||||||||
| 97 | "Comment va Arthur, ton poisson rouge?", | ||||||||||||||
| 98 | "Ton chien a fini de bouffer les rideaux?", | ||||||||||||||
| 99 | "Ton chat pisse encore partout?", | ||||||||||||||
| 100 | "Tu sais ce que fait ta fille, là?", | ||||||||||||||
| 101 | "T'as pas encore claqué ton chef?", | ||||||||||||||
| 102 | "Toi, tu t'es engueulé avec ta femme, ce matin...", | ||||||||||||||
| 103 | "T'as les yeux en forme de contener. Soucis?", | ||||||||||||||
| 104 | "Et si je partais en boucle infinie?", | ||||||||||||||
| 105 | "T'es venu à pied?", | ||||||||||||||
| 106 | "Et si je veux pas exécuter la prochaine commande?", | ||||||||||||||
| 107 | "Tiens, je vais me transformer en virus...", | ||||||||||||||
| 108 | "Ca t'en bouche un coin, un script qui parle, hein?", | ||||||||||||||
| 109 | "Ah m...., j'ai oublié les clés à l'intérieur de la voiture...", | ||||||||||||||
| 110 | "T'as pas autre chose à faire, là?", | ||||||||||||||
| 111 | "Ca devient relou...", | ||||||||||||||
| 112 | "T'as pensé à aller voir un psy?", | ||||||||||||||
| 113 | "Toi, tu pense à changer de job..." | ||||||||||||||
| 114 | ], | ||||||||||||||
| 115 | 'en' => ["-- this line will never be written --", | ||||||||||||||
| 116 | "(scratch scratch ...)", | ||||||||||||||
| 117 | "TOOOOO!!!! A DONUT !!!"], | ||||||||||||||
| 118 | ); | ||||||||||||||
| 119 | 2 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=6 SCAR=22.4
Pod
undocumented
| |||||||||||||||
| 120 | 2 | shift; | |||||||||||||
| 121 | 2 | ▶ | my $LC_MESSAGES=lc(shift||'en'); | ||||||||||||
|
Condition50%1/2
shift() || 'en'
MC/DC0%0/1
shift() || 'en'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 122 | 2 | ▶ | if (! $LC_MESSAGES) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 123 | 0 | ▶ | if (exists $ENV{'LC_MESSAGES'}) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 124 | 0 | $LC_MESSAGES=substr($ENV{'LC_MESSAGES'},0,2); | |||||||||||||
| 125 | } elsif (exists $ENV{'LANG'}) { | ||||||||||||||
| 126 | 0 | $LC_MESSAGES=substr($ENV{'LANG'},0,2); | |||||||||||||
| 127 | } else { | ||||||||||||||
| 128 | 0 | $LC_MESSAGES='en'; | |||||||||||||
| 129 | } | ||||||||||||||
| 130 | } | ||||||||||||||
| 131 | 2 | $LC_MESSAGES=lc($LC_MESSAGES); | |||||||||||||
| 132 | 2 | ▶ | if (! exists $fun{$LC_MESSAGES}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 133 | # carp("You specified a not implemented language: $LC_MESSAGES\nDefaulting to 'en'"); | ||||||||||||||
| 134 | 1 | $LC_MESSAGES='en'; | |||||||||||||
| 135 | } | ||||||||||||||
| 136 | 2 | return ($LC_MESSAGES,\@{ $fun{$LC_MESSAGES} }); | |||||||||||||
| 137 | }; | ||||||||||||||
| 138 | 1 | 1; | |||||||||||||