mapbox / mapbox-gl-language

Switch language of your Mapbox GL JS style
https://mapbox.github.io/mapbox-gl-language/
BSD 3-Clause "New" or "Revised" License
194 stars 51 forks source link

cannot translate the whole map to Chinese #50

Closed lance0109 closed 1 year ago

lance0109 commented 3 years ago

image

version: "@mapbox/mapbox-gl-language": "^1.0.0", "mapbox-gl": "^2.4.0"

styles: 'mapbox://styles/mapbox/light-v10'

this.mapInstance = this.swiperIdx.map((idx) => {
       const mapDom = document.querySelector(
              `${BASE_MAP_CLASS}${idx}`
       );

       return new mapboxgl.Map({
               container: mapDom,
               style: MAP_STYLE_LIGHT,
               minZoom: 1,
               zoom: 2,
       });
});

mapboxgl.setRTLTextPlugin(
        'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js'
);

this.mapInstance.map((map) => {
        map.addControl(new mapboxgl.NavigationControl(), 'top-right');

        map.addControl(
                new MapboxLanguage({
                       defaultLanguage: 'zh-Hans',
                })
        );
});

When set the language to 'zh-Hans', just translate China & Japan to Chinese, not whole world.

devgioele commented 2 years ago

I have a similar issue, where labels of South Tyrol are not translated

teenageknight commented 1 year ago

This might not be your issue, but i had a similar issue and mine was becuase the map style i was using was not supported correctly. If you want to check, use mapbox://styles/mapbox/streets-v11 as your style to test

teenageknight commented 1 year ago

When you get a style that is based on v8 but is a custom style, it doesnt actually error out, it just localizes all the languages based on their local areas (ie china is in chinese, iran is arabic, etc etc). Try it with a default style

lance0109 commented 1 year ago

it works fine in live server. close the ticket.