Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override address_format translation in wp-config.php and filter #129

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions include/ACFFieldOpenstreetmap/Core/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
],
];

Expand Down