Changed the filters for checkout field locales - lets you override the base country labels

This commit is contained in:
Mike Jolley 2012-04-10 13:07:23 +01:00
parent 9f65e7e1cb
commit ee574e1ef8
4 changed files with 14 additions and 6 deletions

View File

@ -713,6 +713,7 @@ jQuery(document).ready(function($) {
// Handle locale fields
var locale_fields = {
'address_1' : '#billing_address_1_field, #shipping_address_1_field',
'address_2' : '#billing_address_2_field, #shipping_address_2_field',
'state' : '#billing_state_field, #shipping_state_field',
'postcode' : '#billing_postcode_field, #shipping_postcode_field',

File diff suppressed because one or more lines are too long

View File

@ -644,10 +644,10 @@ class WC_Countries {
/** Get country locale settings */
function get_country_locale() {
if (!$this->locale) :
if ( ! $this->locale ) {
// Locale information used by the checkout
$this->locale = apply_filters('woocommerce_localisation_address_fields', array(
$this->locale = apply_filters('woocommerce_get_country_locale', array(
'AT' => array(
'postcode_before_city' => true,
'state' => array(
@ -846,9 +846,9 @@ class WC_Countries {
),
));
$this->locale = array_intersect_key($this->locale, $this->get_allowed_countries());
$this->locale = array_intersect_key( $this->locale, $this->get_allowed_countries() );
$this->locale['default'] = apply_filters('woocommerce_localisation_default_address_fields', array(
$this->locale['default'] = apply_filters('woocommerce_get_country_locale_default', array(
'address_2' => array(
'required' => false
),
@ -869,7 +869,13 @@ class WC_Countries {
)
));
endif;
// Filter default AND shop base locales to allow overides via a single function. These will be used when changing countries on the checkout
if ( ! isset( $this->locale[ $this->get_base_country() ] ) ) $this->locale[ $this->get_base_country() ] = array();
$this->locale['default'] = apply_filters( 'woocommerce_get_country_locale_base', $this->locale['default'] );
$this->locale[ $this->get_base_country() ] = apply_filters( 'woocommerce_get_country_locale_base', $this->locale[ $this->get_base_country() ] );
}
return $this->locale;

View File

@ -161,6 +161,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Localization - Canada post code locale
* Localization - RMB paypal
* Localization - Bundled translation updates
* Localization - Changed the filters for checkout field locales - lets you override the base country labels
= 1.5.3 - 29/03/2012 =
* Feature - Debug/status page with some handy functions to resolve common issues