mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.09k stars 2.21k forks source link

remove language checks from client #11968

Open ansis opened 2 years ago

ansis commented 2 years ago

We should stop validating whether a language is supported by a particular source.

https://github.com/mapbox/mapbox-gl-js/blob/b456388a97903fbfe94d8d4d66f0eceb53a0bebd/src/source/vector_tile_source.js#L215

The API has it's own checks and expects that we may provide an unsupported language.

There are a couple problems with the current implementation:

Extended language subtag not handled properly

map.setLanguage('es') map.setLanguage('fr-CA')

Expected: show map in fr Actual: still shows es

Does not switch back to default properly

map.setLanguage('es') map.setLanguage('zz')

Expected: Switch source back to default Actual: Source stays with es

Different behavior before/after tilejson loaded

There is different behavior when the tilejson has loaded already vs hasn't. This is inconsistent. If we may skip validation in some cases we should skip it in all cases.

jonnymccullagh commented 1 year ago

Just checking if my problem is related to this issue? I received an error:

Error: Language ga is not supported
    at ajax.js:184:36
fire @ evented.js:151

ga (Irish) is a supported language in OSM.