@maptiler/sdk 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -883,6 +883,12 @@
883
883
  * AUTO mode uses the language of the browser
884
884
  */
885
885
  AUTO: "auto",
886
+ /**
887
+ * STYLE is a custom flag to keep the language of the map as defined into the style.
888
+ * If STYLE is set in the constructor, then further modification of the language
889
+ * with `.setLanguage()` is not possible.
890
+ */
891
+ STYLE_LOCK: "style_lock",
886
892
  /**
887
893
  * Default fallback languages that uses latin charaters
888
894
  */
@@ -3085,6 +3091,12 @@
3085
3091
  * @param language
3086
3092
  */
3087
3093
  setPrimaryLanguage(language = defaults.primaryLanguage) {
3094
+ if (this.primaryLanguage === Language.STYLE_LOCK) {
3095
+ console.warn(
3096
+ "The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag."
3097
+ );
3098
+ return;
3099
+ }
3088
3100
  if (!isLanguageSupported(language)) {
3089
3101
  return;
3090
3102
  }
@@ -3103,7 +3115,7 @@
3103
3115
  "case",
3104
3116
  ["has", langStr],
3105
3117
  ["get", langStr],
3106
- ["get", "name:latin"]
3118
+ ["get", "name"]
3107
3119
  ];
3108
3120
  for (let i = 0; i < layers.length; i += 1) {
3109
3121
  const layer = layers[i];
@@ -3164,6 +3176,12 @@
3164
3176
  * @param language
3165
3177
  */
3166
3178
  setSecondaryLanguage(language = defaults.secondaryLanguage) {
3179
+ if (this.primaryLanguage === Language.STYLE_LOCK) {
3180
+ console.warn(
3181
+ "The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag."
3182
+ );
3183
+ return;
3184
+ }
3167
3185
  if (!isLanguageSupported(language)) {
3168
3186
  return;
3169
3187
  }