diff --git a/lib/WebGUI/Shop/TaxDriver/EU.pm b/lib/WebGUI/Shop/TaxDriver/EU.pm index b2f82e339..ba8330595 100644 --- a/lib/WebGUI/Shop/TaxDriver/EU.pm +++ b/lib/WebGUI/Shop/TaxDriver/EU.pm @@ -149,6 +149,7 @@ sub addVATNumber { my $user = shift || $self->session->user; my $localCheckOnly = shift; my $db = $self->session->db; + my $i18n = WebGUI::International->new( $self->session, 'TaxDriver_EU' ); WebGUI::Error::InvalidParam->throw( 'A VAT number is required' ) unless $number; @@ -163,7 +164,7 @@ sub addVATNumber { # Number contains syntax error does not exist. Do not write the code to the db. if ( !$numberIsValid && $validator->get_last_error_code <= 16 ) { - return 'The entered VAT number is invalid.'; + return $i18n->get('vat number invalid'); } # Write the code to the db. @@ -176,7 +177,7 @@ sub addVATNumber { 0, ] ); - return $numberIsValid ? undef : 'Number validation currently not available. Check later.'; + return $numberIsValid ? undef : $i18n->get('vies unavailable'); } #------------------------------------------------------------------- @@ -282,12 +283,12 @@ Returns the form that contains the configuration options for this plugin in the sub getConfigurationScreen { my $self = shift; my $session = $self->session; - my $i18n = WebGUI::International->new( $session, 'Shop' ); + my $i18n = WebGUI::International->new( $session, 'TaxDriver_EU' ); my $taxGroups = $self->get( 'taxGroups' ) || []; tie my %countryOptions, 'Tie::IxHash', ( - '' => ' - select a country - ', + '' => ' - ' . $i18n->get('select country') . ' - ', %EU_COUNTRIES, ); @@ -308,57 +309,43 @@ sub getConfigurationScreen { $f->selectBox( name => 'shopCountry', value => $self->get( 'shopCountry' ), - label => 'Residential country', - hoverHelp => 'The country where your shop resides.', + label => $i18n->get('shop country'), + hoverHelp => $i18n->get('shop country help'), options => \%countryOptions, ); $f->template( name => 'userTemplateId', value => $self->get('userTemplateId'), - label => 'User screen template', + label => $i18n->get('user template'), + hoverHelp => $i18n->get('user template help'), namespace => 'TaxDriver/EU/User', ); $f->yesNo( name => 'automaticViesApproval', - value => $self->get( 'automaticViesApproval' ), - label => 'Automatic VIES approval?', + value => $self->get('automaticViesApproval'), + label => $i18n->get('auto vies approval'), + hoverHelp => $i18n->get('auto vies approval help'), ); $f->yesNo( name => 'acceptOnViesUnavailable', - value => $self->get( 'acceptOnViesUnavailable' ), - label => 'Accept VAT numbers when VIES is unavailable?', + value => $self->get('acceptOnViesUnavailable'), + label => $i18n->get('accept when vies unavailable'), + hoverHelp => $i18n->get('accept when vies unavailable help'), ); $f->submit; my $general = $f->print; # VAT groups manager - my $vatGroups = 'VAT groups
'; - $vatGroups .= q{}; - foreach my $group ( @{ $taxGroups} ) { - my $deleteUrl = $session->url->page('shop=tax;method=do;do=deleteGroup;groupId=' . $group->{ id }); - my $makeDefaultUrl = $session->url->page('shop=tax;method=do;do=setDefaultGroup;groupId=' . $group->{ id }); - - $vatGroups .= - q{}; - } - $vatGroups .= q{
Group nameRate
} - . join( '', - $group->{ name } . ( $group->{ id } eq $self->get( 'defaultGroup' ) ? '(default)' : '' ), - $group->{ rate }, - qq{delete}, - qq{Set as default group}, - ) - . q{
}; - $vatGroups = - 'Add a VAT group' + my $vatGroups = + '' . $i18n->get('add vat group') . '' . WebGUI::Form::formHeader( $session, { extras => 'id="addGroupForm"' } ) - . WebGUI::Form::hidden( $session, { name => 'shop', value => 'tax' } ) - . WebGUI::Form::hidden( $session, { name => 'method', value => 'do' } ) - . WebGUI::Form::hidden( $session, { name => 'do', value => 'addGroup' } ) - . ' Name ' + . WebGUI::Form::hidden( $session, { name => 'shop', value => 'tax' } ) + . WebGUI::Form::hidden( $session, { name => 'method', value => 'do' } ) + . WebGUI::Form::hidden( $session, { name => 'do', value => 'addGroup' } ) + . $i18n->get('group name') . WebGUI::Form::text( $session, { name => 'name' } ) - . ' Rate ' + . $i18n->get('rate') . WebGUI::Form::float( $session, { name => 'rate' } ) . '%' . WebGUI::Form::submit( $session, { value => 'Add' } ) @@ -380,14 +367,17 @@ sub getConfigurationScreen { $style->setScript($url->extras('yui/build/datasource/datasource-min.js'), {type => 'text/javascript'}); $style->setScript($url->extras('yui/build/datatable/datatable-min.js'), {type => 'text/javascript'}); $style->setScript($url->extras('yui/build/button/button-min.js'), {type => 'text/javascript'}); - + + my $generalLabel = $i18n->get('general configuration'); + my $groupsLabel = $i18n->get('vat groups'); + my $numbersLabel = $i18n->get('vat numbers'); my $output = <
$general
@@ -404,43 +394,56 @@ sub getConfigurationScreen { EOHTML + # labels + my $groupNameLabel = $i18n->get('group name'); + my $groupRateLabel = $i18n->get('rate'); + my $defaultLabel = $i18n->get('default group'); + my $makeDefaultLabel= $i18n->get('make default'); + my $deleteLabel = $i18n->get('delete group'); + my $userIdLabel = $i18n->get('user id'); + my $vatNumberLabel = $i18n->get('vat number'); + my $validatedLabel = $i18n->get('vies validated'); + my $viesErrorLabel = $i18n->get('vies error code'); + my $approveLabel = $i18n->get('approve'); + my $denyLabel = $i18n->get('deny'); + + # urls + my $getTaxGroupsUrl = $url->page( 'shop=tax;method=do;do=getTaxGroupsAsJSON' ); + my $getVATNumbersUrl = $url->page( 'shop=tax;method=do;do=getVATNumbersAsJSON' ); + $output .= qq|