-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce the hash URL param presetUrlOverwrite
#9475
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ import { fileFetcher } from './file_fetcher'; | |
import { utilDetect } from '../util/detect'; | ||
import { utilStringQs } from '../util'; | ||
import { utilArrayUniq } from '../util/array'; | ||
import { presetsCdnUrl } from '../../config/id.js'; | ||
import { presetsCdnUrlTemplate } from '../../config/id.js'; | ||
import packageJSON from '../../package.json'; | ||
|
||
let _mainLocalizer = coreLocalizer(); // singleton | ||
let _t = _mainLocalizer.t; | ||
|
@@ -88,6 +89,8 @@ export function coreLocalizer() { | |
'locales' // load the list of supported locales | ||
]; | ||
|
||
const presetsVersion = packageJSON.devDependencies['@openstreetmap/id-tagging-schema']; | ||
const presetsCdnUrl = presetsCdnUrlTemplate.replace('{presets_version}', presetsVersion); | ||
Comment on lines
+92
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually… this was working as intended:
To avoid this, the fileFetcher does first load the preset's -- The url template can be passed to the fileFetcher: const localeDirs = {
general: 'locales',
tagging: presetsCdnUrlTemplate + 'dist/translations'
}; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tyrasd even thought this PR is closed, I think your feedback and the fact that I was not able to read those details from the variable names hints that the variable names could be improved. The name itself you communicate if its a "template" – as in, something of the string will need to be replaced in order to work – or a URL that will be used as is. This might be something to refactor at some point… |
||
const localeDirs = { | ||
general: 'locales', | ||
tagging: presetsCdnUrl + 'dist/translations' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files (except
presets_package
) should use thepresetsCdnUrlTemplate
instead of. See my comment above.presetsCdnUrlTemplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example: