mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 19:26:41 +02:00
Merge branch 'fix-localized-field-hidden' into develop
This commit is contained in:
@@ -54,6 +54,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Properly sort map features with lifecycle prefixes in the _Past/Futures_ features ([#7582])
|
||||
* Only consider features with either `landuse`, `natural`, `amentiy` or `leisure` tag to be classified as _Landuse_ areas
|
||||
* Fix address field overwriting existing data when switching selected map features under certain circumstances ([#10260])
|
||||
* Show `name` field also when only a localized name is present (e.g. only `name:xy`, but not `name`) and the preset does not show the name field by default ([#10323], thanks [@samhoooo])
|
||||
#### :earth_asia: Localization
|
||||
#### :hourglass: Performance
|
||||
#### :mortar_board: Walkthrough / Help
|
||||
@@ -72,7 +73,9 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#10257]: https://github.com/openstreetmap/iD/pull/10257
|
||||
[#10260]: https://github.com/openstreetmap/iD/issues/10260
|
||||
[#10302]: https://github.com/openstreetmap/iD/issues/10302
|
||||
[#10323]: https://github.com/openstreetmap/iD/issues/10323
|
||||
[@zbycz]: https://github.com/zbycz
|
||||
[@samhoooo]: https://github.com/samhoooo
|
||||
|
||||
|
||||
# 2.29.0
|
||||
|
||||
@@ -8,6 +8,7 @@ import { uiTooltip } from './tooltip';
|
||||
import { geoExtent } from '../geo/extent';
|
||||
import { uiFieldHelp } from './field_help';
|
||||
import { uiFields } from './fields';
|
||||
import { LANGUAGE_SUFFIX_REGEX } from './fields/localized';
|
||||
import { uiTagReference } from './tag_reference';
|
||||
import { utilRebind, utilUniqueDomId } from '../util';
|
||||
|
||||
@@ -97,6 +98,15 @@ export function uiField(context, presetField, entityIDs, options) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (field.type === 'localized') {
|
||||
for (let tagKey in _tags) {
|
||||
// matches for field:<code>, where <code> is a BCP 47 locale code
|
||||
let match = tagKey.match(LANGUAGE_SUFFIX_REGEX);
|
||||
if (match && match[1] === field.key && match[2]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _tags[key] !== undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { uiLengthIndicator } from '../length_indicator';
|
||||
|
||||
var _languagesArray = [];
|
||||
|
||||
export const LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
|
||||
|
||||
export function uiFieldLocalized(field, context) {
|
||||
var dispatch = d3_dispatch('change', 'input');
|
||||
@@ -127,7 +128,7 @@ export function uiFieldLocalized(field, context) {
|
||||
// matches for field:<code>, where <code> is a BCP 47 locale code
|
||||
// motivation is to avoid matching on similarly formatted tags that are
|
||||
// not for languages, e.g. name:left, name:source, etc.
|
||||
var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
|
||||
var m = k.match(LANGUAGE_SUFFIX_REGEX);
|
||||
if (m && m[1] === field.key && m[2]) {
|
||||
var item = { lang: m[2], value: tags[k] };
|
||||
if (existingLangs.has(item.lang)) {
|
||||
|
||||
Reference in New Issue
Block a user