Skip to content

Commit

Permalink
Add multilingual field exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel committed Jan 18, 2023
1 parent 7f21963 commit 3cd2acb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/ui/fields/localized.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ export function uiFieldLocalized(field, context) {
var existingLangs = new Set(existingLangsOrdered.filter(Boolean));

for (var k in tags) {
var m = k.match(/^(.*):(.*)$/);
// 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.
// https://github.com/openstreetmap/iD/pull/9124
var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
if (m && m[1] === field.key && m[2]) {
var item = { lang: m[2], value: tags[k] };
if (existingLangs.has(item.lang)) {
Expand Down

0 comments on commit 3cd2acb

Please sign in to comment.