Skip to content

Commit

Permalink
use 'mul' instead of 'local' to support the local language
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-zelinsky committed Jul 5, 2018
1 parent 400f21f commit a996bed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ Showcasing the languages supported by Mapbox Streets.
- [English](https://mapbox.github.io/mapbox-gl-language/examples/en.html)
- [French](https://mapbox.github.io/mapbox-gl-language/examples/fr.html)
- [German](https://mapbox.github.io/mapbox-gl-language/examples/de.html)
- [Local language](https://mapbox.github.io/mapbox-gl-language/examples/local.html)
- [Japanese](https://mapbox.github.io/mapbox-gl-language/examples/ja.html)
- [Korean](https://mapbox.github.io/mapbox-gl-language/examples/ko.html)
- [Multilingual](https://mapbox.github.io/mapbox-gl-language/examples/multilingual.html)
- [Portuguese](https://mapbox.github.io/mapbox-gl-language/examples/pt.html)
- [Russian](https://mapbox.github.io/mapbox-gl-language/examples/ru.html)
- [Spanish](https://mapbox.github.io/mapbox-gl-language/examples/es.html)
Expand Down
2 changes: 1 addition & 1 deletion examples/local.html → examples/multilingual.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
});
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.0/mapbox-gl-rtl-text.js');
map.addControl(new MapboxLanguage({
defaultLanguage: 'local'
defaultLanguage: 'mul'
}));
</script>

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function MapboxLanguage(options) {
this._defaultLanguage = options.defaultLanguage;
this._isLanguageField = options.languageField || /^\{name/;
this._getLanguageField = options.getLanguageField || function nameField(language) {
return language === 'local' ? '{name}' : '{name_' + language + '}';
return language === 'mul' ? '{name}' : '{name_' + language + '}';
};
this._languageSource = options.languageSource || null;
this._languageTransform = options.languageTransform || function (style, language) {
Expand All @@ -34,7 +34,7 @@ function MapboxLanguage(options) {
}
};
this._excludedLayerIds = options.excludedLayerIds || [];
this.supportedLanguages = options.supportedLanguages || ['ar', 'en', 'es', 'fr', 'de', 'local', 'ja', 'ko', 'pt', 'ru', 'zh'];
this.supportedLanguages = options.supportedLanguages || ['ar', 'en', 'es', 'fr', 'de', 'ja', 'ko', 'mul', 'pt', 'ru', 'zh'];
}

function standardSpacing(style) {
Expand Down
6 changes: 3 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ test('setLanguage for different text fields', (assert) => {
}
}, 'switch style to arabic name field');

var localStyle = language.setLanguage(style, 'local');
assert.deepEqual(localStyle.layers[0].layout, {
var mulStyle = language.setLanguage(style, 'mul');
assert.deepEqual(mulStyle.layers[0].layout, {
'text-letter-spacing': 0.15,
'text-field': {
'base': 1,
Expand All @@ -65,7 +65,7 @@ test('setLanguage for different text fields', (assert) => {
[6, '{name}']
]
}
}, 'switch style to local name field');
}, 'switch style to multilingual name field');

assert.end();
});
Expand Down

0 comments on commit a996bed

Please sign in to comment.