mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix issue where the telephone field placeholders weren't localized
This commit is contained in:
@@ -28,7 +28,10 @@ export function uiFieldText(field, context) {
|
||||
|
||||
if (field.type === 'tel') {
|
||||
fileFetcher.get('phone_formats')
|
||||
.then(function(d) { _phoneFormats = d; })
|
||||
.then(function(d) {
|
||||
_phoneFormats = d;
|
||||
updatePhonePlaceholder();
|
||||
})
|
||||
.catch(function() { /* ignore */ });
|
||||
}
|
||||
|
||||
@@ -67,13 +70,7 @@ export function uiFieldText(field, context) {
|
||||
|
||||
|
||||
if (field.type === 'tel') {
|
||||
var extent = combinedEntityExtent();
|
||||
var countryCode = extent && countryCoder.iso1A2Code(extent.center());
|
||||
var format = countryCode && _phoneFormats[countryCode.toLowerCase()];
|
||||
if (format) {
|
||||
wrap.selectAll('input')
|
||||
.attr('placeholder', format);
|
||||
}
|
||||
updatePhonePlaceholder();
|
||||
|
||||
} else if (field.type === 'number') {
|
||||
var rtl = (localizer.textDirection() === 'rtl');
|
||||
@@ -136,6 +133,16 @@ export function uiFieldText(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function updatePhonePlaceholder() {
|
||||
if (input.empty() || !Object.keys(_phoneFormats).length) return;
|
||||
|
||||
var extent = combinedEntityExtent();
|
||||
var countryCode = extent && countryCoder.iso1A2Code(extent.center());
|
||||
var format = countryCode && _phoneFormats[countryCode.toLowerCase()];
|
||||
if (format) input.attr('placeholder', format);
|
||||
}
|
||||
|
||||
|
||||
function validIdentifierValueForLink() {
|
||||
if (field.type === 'identifier' && field.pattern) {
|
||||
var value = utilGetSetValue(input).trim().split(';')[0];
|
||||
|
||||
Reference in New Issue
Block a user