i18n for Cash plugin

Fix broken link inside Operation/AdSpace.pm
Add a method to be used for developing apps with i18n before
i18n is ready.  This will eventually be used as part of a system
to automatically create i18n files from Perl source.
This commit is contained in:
Colin Kuskie 2006-04-18 18:01:42 +00:00
parent ac55cc1e41
commit f6b336a824
4 changed files with 193 additions and 14 deletions

View file

@ -14,7 +14,7 @@ package WebGUI::Commerce::Payment::Cash;
=head1 NAME
Package WebGUI::Payment::ITransact
Package WebGUI::Payment::Cash
=head1 DESCRIPTION
@ -44,7 +44,7 @@ sub checkoutForm {
my ($self, $u, $f, %months, %years, $i18n);
$self = shift;
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$i18n = WebGUI::International->new($self->session, 'CommercePaymentCash');
$u = WebGUI::User->new($self->session,$self->session->user->userId);
@ -52,12 +52,12 @@ sub checkoutForm {
$f->selectBox(
-name=>"paymentMethod",
-label=>"Payment Method",
-label=>$i18n->get("payment method"),
-value=>[$self->session->form->process("paymentMethod")],
-defaultValue=>['cash'],
-options=> { 'cash' => 'Cash',
'check' => 'Check',
'other' => 'Other'
-options=> { 'cash' => $i18n->get('cash'),
'check' => $i18n->get('check'),
'other' => $i18n->get('other'),
}
);
@ -362,7 +362,7 @@ sub checkoutForm {
sub configurationForm {
my ($self, $f, $i18n);
$self = shift;
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$i18n = WebGUI::International->new($self->session, 'CommercePaymentCash');
$f = WebGUI::HTMLForm->new($self->session);
@ -375,8 +375,8 @@ sub configurationForm {
$f->yesNo(
-name => $self->prepend('completeTransaction'),
-value => $self->get('completeTransaction') || 1,
-label => 'Complete Transaction on Submit?',
-hoverHelp => 'When set to \'yes\', the transaction is completed when the user submits payment details. When set to \'no\', the transaction is set to pending and must be manually set to complete. This may be useful if you wish to allow site visitors to select the Cash Payment method, but would like to wait for payment to clear before completing the transaction.'
-label => $i18n->get('complete transaction'),
-hoverHelp => $i18n->get('complete transaction description'),
);
return $self->SUPER::configurationForm($f->printRowsOnly);
@ -428,7 +428,9 @@ sub errorCode {
#-------------------------------------------------------------------
sub name {
return "Cash";
my ($self) = shift;
my $i18n = WebGUI::International->new($self->session, "CommercePaymentCash");
return $i18n->get('module name');
}
#-------------------------------------------------------------------
@ -444,7 +446,7 @@ sub normalTransaction {
$normal = shift;
if ($normal) {
my $i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
my $i18n = WebGUI::International->new($self->session, 'CommercePaymentCash');
$self->{_transactionParams} = {
AMT => sprintf('%.2f', $normal->{amount}),
DESCRIPTION => $normal->{description} || $i18n->get('no description'),
@ -506,7 +508,7 @@ sub validateFormData {
my ($self, @error, $i18n, $currentYear, $currentMonth);
$self = shift;
$i18n = WebGUI::International->new($self->session,'CommercePaymentITransact');
$i18n = WebGUI::International->new($self->session,'CommercePaymentCash');
push (@error, $i18n->get('invalid firstName')) unless ($self->session->form->process("firstName"));
push (@error, $i18n->get('invalid lastName')) unless ($self->session->form->process("lastName"));

View file

@ -49,6 +49,19 @@ These functions/methods are available from this package:
=cut
#-------------------------------------------------------------------
=head2 echo ( internationalId [ , namespace, language ] )
This method is used to help developers work with i18n before i18n files
have been created. echo simply returns the internationId.
sub echo {
my ($self, $id, $namespace, $language) = @_;
return $id;
}
#-------------------------------------------------------------------
=head2 get ( internationalId [ , namespace, language ] )
@ -89,8 +102,8 @@ sub get {
my $output = eval($cmd);
$self->session->errorHandler->warn("Couldn't get value from ".$cmd." because ".$@) if ($@);
$output = $self->get($id,$namespace,"English") if ($output eq "" && $language ne "English");
$l10nCache{$language}{$namespace}{$id} = $output || $id;
return $output || $id;
$l10nCache{$language}{$namespace}{$id} = $output;
return $output;
}

View file

@ -271,6 +271,12 @@ our $I18N = {
context => q|menu item in ad manager|
},
'confirm ad delete' => {
message => q|Are you certain you want to delete this ad?|,
lastUpdated => 0,
context => q|Message to confirm deletion of an ad in an ad space|
},
'add ad space' => {
message => q|Add ad space.|,
lastUpdated => 0,

View file

@ -0,0 +1,158 @@
package WebGUI::i18n::English::CommercePaymentCash;
our $I18N = {
'phone' => {
message => q|Telephone Number|,
lastUpdated => 0,
context => q|Form label in the checkout form of the iTransact module.|
},
'country' => {
message => q|Country|,
lastUpdated => 0,
context => q|Form label in the checkout form of the iTransact module.|
},
'firstName' => {
message => q|First name|,
lastUpdated => 0,
context => q|Form label in the checkout form of the iTransact module.|
},
'lastName' => {
message => q|Last name|,
lastUpdated => 0,
context => q|Form label in the checkout form of the iTransact module.|
},
'address' => {
message => q|Address|,
lastUpdated => 1101772170,
context => q|Form label in the checkout form of the iTransact module.|
},
'city' => {
message => q|City|,
lastUpdated => 1101772171,
context => q|Form label in the checkout form of the iTransact module.|
},
'state' => {
message => q|State|,
lastUpdated => 1101772173,
context => q|Form label in the checkout form of the iTransact module.|
},
'zipcode' => {
message => q|Zipcode|,
lastUpdated => 1101772174,
context => q|Form label in the checkout form of the iTransact module.|
},
'email' => {
message => q|Email|,
lastUpdated => 1101772176,
context => q|Form label in the checkout form of the iTransact module.|
},
'cardNumber' => {
message => q|Credit card number|,
lastUpdated => 1101772177,
context => q|Form label in the checkout form of the iTransact module.|
},
'expiration date' => {
message => q|Expiration date|,
lastUpdated => 1101772180,
context => q|Form label in the checkout form of the iTransact module.|
},
'cvv2' => {
message => q|Verification number (ie. CVV2)|,
lastUpdated => 1101772182,
context => q|Form label in the checkout form of the iTransact module.|
},
'vendorId' => {
message => q|Username (Vendor ID)|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'use cvv2' => {
message => q|Use CVV2|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'emailMessage' => {
message => q|Email message|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'password' => {
message => q|Password|,
lastUpdated => 0,
context => q|Form label in the configuration form of the iTransact module.|
},
'module name' => {
message => q|Cash|,
lastUpdated => 0,
context => q|The displayed name of the payment module.|
},
'invalid firstName' => {
message => q|You have to enter a valid first name.|,
lastUpdated => 0,
context => q|An error indicating that an invalid first name has been entered.|
},
'invalid lastName' => {
message => q|You have to enter a valid last name.|,
lastUpdated => 0,
context => q|An error indicating that an invalid last name has been entered.|
},
'invalid address' => {
message => q|You have to enter a valid address.|,
lastUpdated => 0,
context => q|An error indicating that an invalid street has been entered.|
},
'invalid city' => {
message => q|You have to enter a valid city.|,
lastUpdated => 0,
context => q|An error indicating that an invalid city has been entered.|
},
'invalid zip' => {
message => q|You have to enter a valid zipcode.|,
lastUpdated => 0,
context => q|An error indicating that an invalid zipcode has been entered.|
},
'invalid email' => {
message => q|You have to enter a valid email address.|,
lastUpdated => 0,
context => q|An error indicating that an invalid email address has been entered.|
},
'no description' => {
message => q|No description|,
lastUpdated => 0,
context => q|The default description of purchase of users.|
},
'cash' => {
message => q|Cash|,
lastUpdated => 0,
context => q|Option to use physical money as a form of payment.|
},
'check' => {
message => q|Check|,
lastUpdated => 0,
context => q|Option to use a check as a form of payment.|
},
'other' => {
message => q|Other|,
lastUpdated => 0,
context => q|Option to use a something aside from cash or check as a payment.|
},
'payment method' => {
message => q|Payment Method|,
lastUpdated => 0,
context => q|Label for selecting how to pay for this purchase.|
},
'complete transaction' => {
message => q|Complete Transaction on Submit?|,
lastUpdated => 0,
},
'complete transaction description' => {
message => q|When set to 'yes', the transaction is completed when the user submits payment details. When set to 'no', the transaction is set to pending and must be manually set to complete. This may be useful if you wish to allow site visitors to select the Cash Payment method, but would like to wait for payment to clear before completing the transaction.|,
lastUpdated => 0,
},
};
1;