Update getaddr.app.js

Add fallback for "system" language
master
gellnerm 2025-02-28 14:42:19 +01:00 committed by GitHub
parent 3c9e3aca20
commit 1fdebeae99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,14 @@
// Set the API endpoint and parameters // Set the API endpoint and parameters
const nominatimApi = 'https://nominatim.openstreetmap.org'; const nominatimApi = 'https://nominatim.openstreetmap.org';
const lang = require("locale").name.substring(0, 2); const locale = require('locale');
let lang = locale.name;
if (lang.toLowerCase() === 'system') {
lang = 'en';
} else {
lang = lang.substring(0, 2);
}
const params = { const params = {
format: 'json', format: 'json',
addressdetails: 1, addressdetails: 1,