Tweak locales. Closes #1194.

This commit is contained in:
Mike Jolley 2012-07-10 13:36:13 +01:00
parent d6183d7853
commit af549be954
2 changed files with 44 additions and 13 deletions

View File

@ -554,6 +554,7 @@ class WC_Countries {
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
'AT' => $postcode_before_city,
'BE' => $postcode_before_city,
'CH' => $postcode_before_city,
'CN' => "{country} {postcode}\n{state}, {city}, {address_2}, {address_1}\n{company}\n{name}",
'CZ' => $postcode_before_city,
'DE' => $postcode_before_city,
@ -564,6 +565,7 @@ class WC_Countries {
'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}",
'IS' => $postcode_before_city,
'IS' => $postcode_before_city,
'LI' => $postcode_before_city,
'NL' => $postcode_before_city,
'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}",
'NO' => $postcode_before_city,
@ -664,6 +666,14 @@ class WC_Countries {
'placeholder' => __('Province', 'woocommerce')
)
),
'CH' => array(
'postcode_before_city' => true,
'state' => array(
'label' => __('Canton', 'woocommerce'),
'placeholder' => __('Canton', 'woocommerce'),
'required' => false
)
),
'CL' => array(
'city' => array(
'required' => false,
@ -795,6 +805,14 @@ class WC_Countries {
'placeholder' => __('Province', 'woocommerce')
)
),
'LI' => array(
'postcode_before_city' => true,
'state' => array(
'label' => __('Municipality', 'woocommerce'),
'placeholder' => __('Municipality', 'woocommerce'),
'required' => false
)
),
'LK' => array(
'state' => array(
'required' => false
@ -949,27 +967,38 @@ class WC_Countries {
'clear' => true
)
);
if (isset($locale[$country])) :
if ( isset( $locale[$country] ) ) {
$fields = woocommerce_array_overlay( $fields, $locale[$country] );
if (isset($locale[$country]['postcode_before_city'])) :
$fields['city']['class'] = array('form-row-last');
$fields['postcode']['class'] = array('form-row-first', 'update_totals_on_change');
endif;
endif;
if ( isset( $locale[$country]['postcode_before_city'] ) ) {
$fields['city']['class'] = array('form-row-last');
$fields['postcode']['class'] = array('form-row-first', 'update_totals_on_change');
$switch_fields = array();
foreach ( $fields as $key => $value ) {
if ( $key == 'city' ) {
// Place postcode before city
$switch_fields['postcode'] = '';
}
$switch_fields[$key] = $value;
}
$fields = $switch_fields;
}
}
// Prepend field keys
$address_fields = array();
foreach ($fields as $key => $value) :
foreach ( $fields as $key => $value ) {
$address_fields[$type . $key] = $value;
endforeach;
}
// Billing/Shipping Specific
if ($type=='billing_') :
if ( $type == 'billing_' ) {
$address_fields['billing_email'] = array(
'label' => __('Email Address', 'woocommerce'),
@ -986,9 +1015,9 @@ class WC_Countries {
);
$address_fields = apply_filters('woocommerce_billing_fields', $address_fields);
else :
} else {
$address_fields = apply_filters('woocommerce_shipping_fields', $address_fields);
endif;
}
// Return
return $address_fields;

View File

@ -169,6 +169,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Colombia zipcodes are not required
* Fix - Conflict with WPML joins
* Fix - IPN check with PayPal redesign
* Localization - LI and CH address locales
* Localization - Switch fields in array if postcode_before_city is set
= 1.5.8 - 21/06/2012 =
* Tweak - Textarea for notes and enabled HTML