-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Gallery Styles: Load different style based on language #959
Conversation
Thanks for taking the time to open this PR! but I don't think this is a good UX. Consider the following somewhat equivalent: you are writing a Google docs document, and every time you want to write in a different language all the UI changes according to the current language. |
@HarelM This does not affect any styles the user loads when inserting an URL. It only affects which style is loaded when selecting the "ProtoMaps Light" default style1. Using your analogy, if I use Google Docs and I go to "Document Templates" I expect those templates to match the interface language. And in fact it does: Footnotes
|
Updated title to be more clear. |
@@ -80,7 +80,7 @@ | |||
{ | |||
"id": "protomaps-light", | |||
"title": "Protomaps Light", | |||
"url": "https://api.protomaps.com/styles/v2/light.json?key=d828297496b11844", | |||
"url": "https://api.protomaps.com/styles/v4/light/$lang.json?key=d828297496b11844", |
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.
I think the common usage is {lang}
and not $lang
in maplibre - glyphs, tiles etc use "{}" for parameters.
@@ -56,6 +56,10 @@ type ModalOpenState = { | |||
activeRequestUrl?: string | null | |||
}; | |||
|
|||
function transformStyleUrl(styleUrl: string, {language}: { language: string }) { | |||
return styleUrl.replace("$lang", language); |
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.
What will happen if the url doesn't support the relevant language?
|
||
describe("load different style depending on selected language", () => { | ||
const testLang = (lang: string) => { | ||
cy.intercept('GET', `**/${lang}.json*`).as(`${lang}JsonRequest`); |
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.
cy specific code should be moved to the driver.
Thanks for the info. |
I will address this differently in another PR so that variations (other languages) of the gallery style can be chosen. I agree that we shouldn't limit ourselves to the languages that happen to be supported by our interface. |
$lang
in the style URL with the selected language.Launch Checklist
CHANGELOG.md
under the## main
section.