Prefer place name in UA/browser language

closes #16
This commit is contained in:
2026-02-10 19:19:36 +04:00
parent 87e2380ef6
commit 64ccc694d3
4 changed files with 38 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
import { fn } from '@ember/helper';
import { on } from '@ember/modifier';
import { humanizeOsmTag } from '../utils/format-text';
import { getLocalizedName } from '../utils/osm';
import Icon from '../components/icon';
import PlaceEditForm from './place-edit-form';
@@ -22,8 +23,7 @@ export default class PlaceDetails extends Component {
get name() {
return (
this.place.title ||
this.tags.name ||
this.tags['name:en'] ||
getLocalizedName(this.tags) ||
'Unnamed Place'
);
}

View File

@@ -7,6 +7,7 @@ import or from 'ember-truth-helpers/helpers/or';
import PlaceDetails from './place-details';
import Icon from './icon';
import humanizeOsmTag from '../helpers/humanize-osm-tag';
import { getLocalizedName } from '../utils/osm';
export default class PlacesSidebar extends Component {
@service storage;
@@ -85,8 +86,7 @@ export default class PlacesSidebar extends Component {
} else {
// It's a fresh POI -> Save it
const placeData = {
title:
place.osmTags.name || place.osmTags['name:en'] || 'Untitled Place',
title: getLocalizedName(place.osmTags, 'Untitled Place'),
lat: place.lat,
lon: place.lon,
tags: [],