Tweak locales. Closes #1194.
This commit is contained in:
parent
d6183d7853
commit
af549be954
|
@ -554,6 +554,7 @@ class WC_Countries {
|
||||||
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
|
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
|
||||||
'AT' => $postcode_before_city,
|
'AT' => $postcode_before_city,
|
||||||
'BE' => $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}",
|
'CN' => "{country} {postcode}\n{state}, {city}, {address_2}, {address_1}\n{company}\n{name}",
|
||||||
'CZ' => $postcode_before_city,
|
'CZ' => $postcode_before_city,
|
||||||
'DE' => $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}",
|
'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}",
|
||||||
'IS' => $postcode_before_city,
|
'IS' => $postcode_before_city,
|
||||||
'IS' => $postcode_before_city,
|
'IS' => $postcode_before_city,
|
||||||
|
'LI' => $postcode_before_city,
|
||||||
'NL' => $postcode_before_city,
|
'NL' => $postcode_before_city,
|
||||||
'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}",
|
'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}",
|
||||||
'NO' => $postcode_before_city,
|
'NO' => $postcode_before_city,
|
||||||
|
@ -663,6 +665,14 @@ class WC_Countries {
|
||||||
'label' => __('Province', 'woocommerce'),
|
'label' => __('Province', 'woocommerce'),
|
||||||
'placeholder' => __('Province', 'woocommerce')
|
'placeholder' => __('Province', 'woocommerce')
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'CH' => array(
|
||||||
|
'postcode_before_city' => true,
|
||||||
|
'state' => array(
|
||||||
|
'label' => __('Canton', 'woocommerce'),
|
||||||
|
'placeholder' => __('Canton', 'woocommerce'),
|
||||||
|
'required' => false
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'CL' => array(
|
'CL' => array(
|
||||||
'city' => array(
|
'city' => array(
|
||||||
|
@ -794,6 +804,14 @@ class WC_Countries {
|
||||||
'label' => __('Province', 'woocommerce'),
|
'label' => __('Province', 'woocommerce'),
|
||||||
'placeholder' => __('Province', 'woocommerce')
|
'placeholder' => __('Province', 'woocommerce')
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'LI' => array(
|
||||||
|
'postcode_before_city' => true,
|
||||||
|
'state' => array(
|
||||||
|
'label' => __('Municipality', 'woocommerce'),
|
||||||
|
'placeholder' => __('Municipality', 'woocommerce'),
|
||||||
|
'required' => false
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'LK' => array(
|
'LK' => array(
|
||||||
'state' => array(
|
'state' => array(
|
||||||
|
@ -950,26 +968,37 @@ class WC_Countries {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($locale[$country])) :
|
if ( isset( $locale[$country] ) ) {
|
||||||
|
|
||||||
$fields = woocommerce_array_overlay( $fields, $locale[$country] );
|
$fields = woocommerce_array_overlay( $fields, $locale[$country] );
|
||||||
|
|
||||||
if (isset($locale[$country]['postcode_before_city'])) :
|
if ( isset( $locale[$country]['postcode_before_city'] ) ) {
|
||||||
$fields['city']['class'] = array('form-row-last');
|
$fields['city']['class'] = array('form-row-last');
|
||||||
$fields['postcode']['class'] = array('form-row-first', 'update_totals_on_change');
|
$fields['postcode']['class'] = array('form-row-first', 'update_totals_on_change');
|
||||||
endif;
|
|
||||||
|
|
||||||
endif;
|
$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
|
// Prepend field keys
|
||||||
$address_fields = array();
|
$address_fields = array();
|
||||||
|
|
||||||
foreach ($fields as $key => $value) :
|
foreach ( $fields as $key => $value ) {
|
||||||
$address_fields[$type . $key] = $value;
|
$address_fields[$type . $key] = $value;
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
// Billing/Shipping Specific
|
// Billing/Shipping Specific
|
||||||
if ($type=='billing_') :
|
if ( $type == 'billing_' ) {
|
||||||
|
|
||||||
$address_fields['billing_email'] = array(
|
$address_fields['billing_email'] = array(
|
||||||
'label' => __('Email Address', 'woocommerce'),
|
'label' => __('Email Address', 'woocommerce'),
|
||||||
|
@ -986,9 +1015,9 @@ class WC_Countries {
|
||||||
);
|
);
|
||||||
|
|
||||||
$address_fields = apply_filters('woocommerce_billing_fields', $address_fields);
|
$address_fields = apply_filters('woocommerce_billing_fields', $address_fields);
|
||||||
else :
|
} else {
|
||||||
$address_fields = apply_filters('woocommerce_shipping_fields', $address_fields);
|
$address_fields = apply_filters('woocommerce_shipping_fields', $address_fields);
|
||||||
endif;
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $address_fields;
|
return $address_fields;
|
||||||
|
|
|
@ -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 - Colombia zipcodes are not required
|
||||||
* Fix - Conflict with WPML joins
|
* Fix - Conflict with WPML joins
|
||||||
* Fix - IPN check with PayPal redesign
|
* 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 =
|
= 1.5.8 - 21/06/2012 =
|
||||||
* Tweak - Textarea for notes and enabled HTML
|
* Tweak - Textarea for notes and enabled HTML
|
||||||
|
|
Loading…
Reference in New Issue