@panoramax/web-viewer 3.2.3-develop-27996c2e → 3.2.3-develop-f7d9ee13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.3-develop-27996c2e",
3
+ "version": "3.2.3-develop-f7d9ee13",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
package/src/utils/i18n.js CHANGED
@@ -14,7 +14,8 @@ import T_zh_Hant from "../translations/zh_Hant.json";
14
14
  const FALLBACK_LOCALE = "en";
15
15
  const TRANSLATIONS = {
16
16
  "da": T_da, "de": T_de, "eo": T_eo, "en": T_en, "es": T_es, "fr": T_fr,
17
- "hu": T_hu, "it": T_it, "ja": T_ja, "pl": T_pl, "sv": T_sv, "zh_Hant": T_zh_Hant,
17
+ "hu": T_hu, "it": T_it, "ja": T_ja, "pl": T_pl, "sv": T_sv, "zh-Hant": T_zh_Hant,
18
+ "zh": T_zh_Hant,
18
19
  };
19
20
 
20
21
  /**
@@ -32,11 +33,11 @@ export function autoDetectLocale(supportedTranslations, fallback) { // eslint-ig
32
33
  case "zh-TW":
33
34
  case "zh-HK":
34
35
  case "zh-MO":
35
- language = "zh_Hant";
36
+ language = "zh-Hant";
36
37
  break;
37
38
  case "zh-CN":
38
39
  case "zh-SG":
39
- language = "zh_Hans";
40
+ language = "zh-Hans";
40
41
  break;
41
42
  default:
42
43
  if (language.length > 2) {
@@ -32,24 +32,24 @@ describe("autoDetectLocale", () => {
32
32
  expect(autoDetectLocale(supportedTranslations, fallback)).toBe("en");
33
33
  });
34
34
 
35
- it("returns zh_Hant for Chinese Traditional locales", () => {
35
+ it("returns zh-Hant for Chinese Traditional locales", () => {
36
36
  Object.defineProperty(window.navigator, "languages", {
37
37
  value: ["zh-TW"],
38
38
  configurable: true
39
39
  });
40
- const supportedTranslations = ["zh_Hant", "zh_Hans", "en"];
40
+ const supportedTranslations = ["zh-Hant", "zh-Hans", "en"];
41
41
  const fallback = "en";
42
- expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh_Hant");
42
+ expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh-Hant");
43
43
  });
44
44
 
45
- it("returns zh_Hans for Chinese Simplified locales", () => {
45
+ it("returns zh-Hans for Chinese Simplified locales", () => {
46
46
  Object.defineProperty(window.navigator, "languages", {
47
47
  value: ["zh-CN"],
48
48
  configurable: true
49
49
  });
50
- const supportedTranslations = ["zh_Hant", "zh_Hans", "en"];
50
+ const supportedTranslations = ["zh-Hant", "zh-Hans", "en"];
51
51
  const fallback = "en";
52
- expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh_Hans");
52
+ expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh-Hans");
53
53
  });
54
54
 
55
55
  it("returns first matched language even when navigator language has region", () => {
@@ -105,7 +105,7 @@ describe("getTranslations", () => {
105
105
  });
106
106
 
107
107
  it("works when primary lang code exists", () => {
108
- const res = getTranslations("fr_FR");
108
+ const res = getTranslations("fr-FR");
109
109
  expect(res.map.loading).toBe("Chargement…");
110
110
  });
111
111
  });