fs_passwd.cgi
[freeside.git] / bin / populate-msgcat
1 #!/usr/bin/perl -Tw
2
3 use strict;
4 use FS::UID qw(adminsuidsetup);
5 use FS::Record qw(qsearch);
6 use FS::msgcat;
7
8 my $user = shift or die &usage;
9 adminsuidsetup $user;
10
11 foreach my $del_msgcat ( qsearch('msgcat', {}) ) {
12   my $error = $del_msgcat->delete;
13   die $error if $error;
14 }
15
16 my %messages = messages();
17
18 foreach my $msgcode ( keys %messages ) {
19   foreach my $locale ( keys %{$messages{$msgcode}} ) {
20     my $msgcat = new FS::msgcat( {
21       'msgcode' => $msgcode,
22       'locale'  => $locale,
23       'msg'     => $messages{$msgcode}{$locale},
24     });
25     my $error = $msgcat->insert;
26     die $error if $error;
27   }
28 }
29
30 #print "Message catalog initialized sucessfully\n";
31
32 sub messages {
33
34   #  'msgcode' => {
35   #    'en_US' => 'Message',
36   #  },
37
38   (
39
40     'passwords_dont_match' => {
41       'en_US' => "Passwords don't match",
42     },
43
44     'invalid_card' => {
45       'en_US' => 'Invalid credit card number',
46     },
47
48     'unknown_card_type' => {
49       'en_US' => 'Unknown card type',
50     },
51
52     'not_a' => {
53       'en_US' => 'Not a ',
54     },
55
56     'empty_password' => {
57       'en_US' => 'Empty password',
58     },
59
60     'no_access_number_selected' => {
61       'en_US' => 'No access number selected',
62     },
63
64     'illegal_text' => {
65       'en_US' => 'Illegal (text)',
66       #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in field',
67     },
68
69     'illegal_or_empty_text' => {
70       'en_US' => 'Illegal or empty (text)',
71       #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in required field',
72     },
73
74     'illegal_username' => {
75       'en_US' => 'Illegal username',
76     },
77
78     'illegal_password' => {
79       'en_US' => 'Illegal password (',
80     },
81
82     'illegal_password_characters' => {
83       'en_US' => ' characters)',
84     },
85
86     'username_in_use' => {
87       'en_US' => 'Username in use',
88     },
89
90     'illegal_email_invoice_address' => {
91       'en_US' => 'Illegal email invoice address',
92     },
93
94     'illegal_name' => {
95       'en_US' => 'Illegal (name)',
96       #'en_US' => 'Only letters, numbers, spaces and the following punctuation symbols are permitted: , . - \' in field',
97     },
98
99     'illegal_phone' => {
100       'en_US' => 'Illegal (phone)',
101       #'en_US' => '',
102     },
103
104     'illegal_zip' => {
105       'en_US' => 'Illegal (zip)',
106       #'en_US' => '',
107     },
108
109     'expired_card' => {
110       'en_US' => 'Expired card',
111     },
112
113     'daytime' => {
114       'en_US' => 'Day Phone',
115     },
116
117     'night' => {
118       'en_US' => 'Night Phone',
119     },
120
121   );
122 }
123
124 sub usage {
125   die "Usage:\n\n  populate-msgcat user\n";
126 }
127