Update to iD v2.18.1
This commit is contained in:
parent
c9310e10a4
commit
b7f022ecbe
2 changed files with 46 additions and 26 deletions
70
vendor/assets/iD/iD.js
vendored
70
vendor/assets/iD/iD.js
vendored
|
@ -18292,6 +18292,21 @@
|
|||
localizer.scriptNames = () => _scriptNames;
|
||||
|
||||
|
||||
// The client app may want to manually set the locale, regardless of the
|
||||
// settings provided by the browser
|
||||
let _preferredLocaleCodes = [];
|
||||
localizer.preferredLocaleCodes = function(codes) {
|
||||
if (!arguments.length) return _preferredLocaleCodes;
|
||||
if (typeof codes === 'string') {
|
||||
// be generous and accept delimited strings as input
|
||||
_preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
|
||||
} else {
|
||||
_preferredLocaleCodes = codes;
|
||||
}
|
||||
return localizer;
|
||||
};
|
||||
|
||||
|
||||
var _loadPromise;
|
||||
|
||||
localizer.ensureLoaded = () => {
|
||||
|
@ -18309,15 +18324,10 @@
|
|||
_dataLocales = results[1];
|
||||
})
|
||||
.then(() => {
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
|
||||
if (hash.locale && _dataLocales[hash.locale]) {
|
||||
// the locale can be manually set in the URL hash
|
||||
_localeCode = hash.locale;
|
||||
} else {
|
||||
// otherwise use the locale specified by the browser
|
||||
_localeCode = supportedBrowserLocale();
|
||||
}
|
||||
let requestedLocales = (_preferredLocaleCodes || [])
|
||||
// list of locales preferred by the browser in priority order
|
||||
.concat(utilDetect().browserLocales);
|
||||
_localeCode = bestSupportedLocale(requestedLocales);
|
||||
|
||||
return Promise.all([
|
||||
// always load the English locale strings as fallbacks
|
||||
|
@ -18332,34 +18342,32 @@
|
|||
.catch(err => console.error(err)); // eslint-disable-line
|
||||
};
|
||||
|
||||
// Returns the best locale requested by the browser supported by iD, if any
|
||||
function supportedBrowserLocale() {
|
||||
// list of locales preferred by the browser in priority order
|
||||
let browserLocales = utilDetect().browserLocales;
|
||||
// Returns the best locale from `locales` supported by iD, if any
|
||||
function bestSupportedLocale(locales) {
|
||||
let supportedLocales = _dataLocales;
|
||||
|
||||
for (let i in browserLocales) {
|
||||
let browserLocale = browserLocales[i];
|
||||
if (browserLocale.includes('-')) { // full locale ('es-ES')
|
||||
for (let i in locales) {
|
||||
let locale = locales[i];
|
||||
if (locale.includes('-')) { // full locale ('es-ES')
|
||||
|
||||
if (supportedLocales[browserLocale]) return browserLocale;
|
||||
if (supportedLocales[locale]) return locale;
|
||||
|
||||
// If full locale not supported ('es-FAKE'), fallback to the base ('es')
|
||||
let langPart = browserLocale.split('-')[0];
|
||||
let langPart = locale.split('-')[0];
|
||||
if (supportedLocales[langPart]) return langPart;
|
||||
|
||||
} else { // base locale ('es')
|
||||
|
||||
// prefer a lower-priority full locale with this base ('es' < 'es-ES')
|
||||
let fullLocale = browserLocales.find((locale, index) => {
|
||||
let fullLocale = locales.find((locale2, index) => {
|
||||
return index > i &&
|
||||
locale !== browserLocale &&
|
||||
locale.split('-')[0] === browserLocale &&
|
||||
supportedLocales[locale];
|
||||
locale2 !== locale &&
|
||||
locale2.split('-')[0] === locale &&
|
||||
supportedLocales[locale2];
|
||||
});
|
||||
if (fullLocale) return fullLocale;
|
||||
|
||||
if (supportedLocales[browserLocale]) return browserLocale;
|
||||
if (supportedLocales[locale]) return locale;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114037,7 +114045,7 @@
|
|||
if (sawVersion === null && matchedVersion !== null) {
|
||||
if (corePreferences('sawVersion')) {
|
||||
isNewUser = false;
|
||||
isNewVersion = corePreferences('sawVersion') !== currVersion;
|
||||
isNewVersion = corePreferences('sawVersion') !== currVersion && currVersion.indexOf('-') === -1;
|
||||
} else {
|
||||
isNewUser = true;
|
||||
isNewVersion = true;
|
||||
|
@ -117897,7 +117905,7 @@
|
|||
let context = utilRebind({}, dispatch$1, 'on');
|
||||
let _deferred = new Set();
|
||||
|
||||
context.version = '2.18.0';
|
||||
context.version = '2.18.1';
|
||||
context.privacyVersion = '20200407';
|
||||
|
||||
// iD will alter the hash so cache the parameters intended to setup the session
|
||||
|
@ -117985,6 +117993,14 @@
|
|||
};
|
||||
|
||||
|
||||
// A string or array or locale codes to prefer over the browser's settings
|
||||
context.locale = function(locale) {
|
||||
if (!arguments.length) return _mainLocalizer.localeCode();
|
||||
_mainLocalizer.preferredLocaleCodes(locale);
|
||||
return context;
|
||||
};
|
||||
|
||||
|
||||
function afterLoad(cid, callback) {
|
||||
return (err, result) => {
|
||||
if (err) {
|
||||
|
@ -118404,6 +118420,10 @@
|
|||
_mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(',')));
|
||||
}
|
||||
|
||||
if (context.initialHashParams.locale) {
|
||||
_mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
|
||||
}
|
||||
|
||||
// kick off some async work
|
||||
_mainLocalizer.ensureLoaded();
|
||||
_background.ensureLoaded();
|
||||
|
|
2
vendor/assets/iD/iD/locales/en.json
vendored
2
vendor/assets/iD/iD/locales/en.json
vendored
|
@ -9523,7 +9523,7 @@
|
|||
},
|
||||
"shop/craft": {
|
||||
"name": "Arts & Crafts Store",
|
||||
"terms": "art*,paint*,frame"
|
||||
"terms": "art*,paint*,frame,hobby"
|
||||
},
|
||||
"shop/curtain": {
|
||||
"name": "Curtain Store",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue