diff --git a/include/ACFFieldOpenstreetmap/Core/Core.php b/include/ACFFieldOpenstreetmap/Core/Core.php index fccdbe8..011a80c 100644 --- a/include/ACFFieldOpenstreetmap/Core/Core.php +++ b/include/ACFFieldOpenstreetmap/Core/Core.php @@ -115,6 +115,27 @@ public function register_assets() { $geocoder_name = $geocoder_settings['engine']; + + $address_format = apply_filters('acf_osm_address_format', [ + /* + - Available placeholders: {building} {road} {house_number} {postcode} {city} {town} {village} {hamlet} {state} {country} + - You can also override those translations in wp-config.php with ACF_OSM_I18N_ADDR_STREET, ACF_OSM_I18N_ADDR_CITY and ACF_OSM_I18N_ADDR_COUNTRY + */ + /* translators: address format for marker labels (street level). */ + 'street'=> defined('ACF_OSM_I18N_ADDR_STREET') + ? constant('ACF_OSM_I18N_ADDR_STREET') : __( '{building} {road} {house_number}', + 'acf-openstreetmap-field' ), + /* translators: address format for marker labels (city level). */ + 'city' => defined('ACF_OSM_I18N_ADDR_CITY') + ? constant('ACF_OSM_I18N_ADDR_CITY') + : __( '{postcode} {city} {town} {village} {hamlet}', + 'acf-openstreetmap-field' ), + /* translators: address format for marker labels (country level). */ + 'country' => defined('ACF_OSM_I18N_ADDR_COUNTRY') + ? constant('ACF_OSM_I18N_ADDR_COUNTRY') + : __( '{state} {country}', 'acf-openstreetmap-field' ), + ]); + $osm_admin = [ 'options' => [ 'osm_layers' => $osm_providers->get_layers(), // flat list @@ -150,14 +171,7 @@ public function register_assets() { => __( 'Add Marker at location', 'acf-openstreetmap-field' ), 'fit_markers_in_view' => __( 'Fit markers into view', 'acf-openstreetmap-field' ), - 'address_format' => [ - /* translators: address format for marker labels (street level). Available placeholders {building} {road} {house_number} {postcode} {city} {town} {village} {hamlet} {state} {country} */ - 'street' => __( '{building} {road} {house_number}', 'acf-openstreetmap-field' ), - /* translators: address format for marker labels (city level). Available placeholders {building} {road} {house_number} {postcode} {city} {town} {village} {hamlet} {state} {country} */ - 'city' => __( '{postcode} {city} {town} {village} {hamlet}', 'acf-openstreetmap-field' ), - /* translators: address format for marker labels (country level). Available placeholders {building} {road} {house_number} {postcode} {city} {town} {village} {hamlet} {state} {country} */ - 'country' => __( '{state} {country}', 'acf-openstreetmap-field' ), - ] + 'address_format' => $address_format, ], ];