vipassana-design-standards 0.0.26 → 0.0.28

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.
@@ -1,5 +1,18 @@
1
1
  import i18n from './i18n.js'
2
2
 
3
+ function fixLocale(locale) {
4
+ const mapping = {
5
+ 'zh-Hans': 'zh-HANS',
6
+ 'zh-Hant': 'zh-HANT',
7
+ 'zh-HK': 'zh-HANT-HK',
8
+ 'zh-CN': 'zh-HANS',
9
+ 'zh-TW': 'zh-HANT',
10
+ }
11
+ if (mapping[locale]) locale = mapping[locale] // zh-Hans -> zh-HANS
12
+ else locale = locale.split("-")[0] // fr-CA -> fr
13
+ return locale
14
+ }
15
+
3
16
  function isRtl(locale) {
4
17
  return ['ar', 'fa', 'he'].includes(locale)
5
18
  }
@@ -8,7 +21,7 @@ function vdsAssetUrl(path, localhost = false) {
8
21
  // For localhost dev, just run vscode liveserver
9
22
  if (localhost) return `http://localhost:5500/dist/${path}`
10
23
 
11
- return `https://design-standards.dhamma.org/dist/0.0.26/${path}`
24
+ return `https://design-standards.dhamma.org/dist/0.0.28/${path}`
12
25
  }
13
26
 
14
27
  function stylesheetLinkTag(url) {
@@ -24,6 +37,7 @@ export function vdsFaviconTag() {
24
37
  }
25
38
 
26
39
  export function vdsBootstrapThemeCssTag(locale, localhost = false) {
40
+ locale = fixLocale(locale)
27
41
  let tags = [
28
42
  stylesheetLinkTag(vdsAssetUrl(`css/bootstrap5-theme${isRtl(locale) ? '.rtl' : ''}.min.css`, localhost))
29
43
  ]
@@ -35,6 +49,7 @@ export function vdsBootstrapThemeCssTag(locale, localhost = false) {
35
49
  }
36
50
 
37
51
  export function VdsBootstrapThemeCssTag({ locale, localhost = false }) {
52
+ locale = fixLocale(locale)
38
53
  const url = vdsAssetUrl(`css/bootstrap5-theme${isRtl(locale) ? '.rtl' : ''}.min.css`, localhost)
39
54
  return <>
40
55
  <StylesheetLinkTag url={url}/>
@@ -47,7 +62,7 @@ export function vdsBootstrapThemeJsTag(locale, localhost = false) {
47
62
  }
48
63
 
49
64
  export function vdsLogo({locale, disposition = "default", size = '17', tagline = true, dark = false}) {
50
- locale = locale.split("-")[0]
65
+ locale = fixLocale(locale)
51
66
  let trans = i18n[locale] || i18n.en
52
67
 
53
68
  if (disposition == "mobile") {
@@ -1,5 +1,18 @@
1
1
  import i18n from './i18n.js'
2
2
 
3
+ function fixLocale(locale) {
4
+ const mapping = {
5
+ 'zh-Hans': 'zh-HANS',
6
+ 'zh-Hant': 'zh-HANT',
7
+ 'zh-HK': 'zh-HANT-HK',
8
+ 'zh-CN': 'zh-HANS',
9
+ 'zh-TW': 'zh-HANT',
10
+ }
11
+ if (mapping[locale]) locale = mapping[locale] // zh-Hans -> zh-HANS
12
+ else locale = locale.split("-")[0] // fr-CA -> fr
13
+ return locale
14
+ }
15
+
3
16
  function isRtl(locale) {
4
17
  return ['ar', 'fa', 'he'].includes(locale)
5
18
  }
@@ -8,7 +21,7 @@ function vdsAssetUrl(path, localhost = false) {
8
21
  // For localhost dev, just run vscode liveserver
9
22
  if (localhost) return `http://localhost:5500/dist/${path}`
10
23
 
11
- return `https://design-standards.dhamma.org/dist/0.0.26/${path}`
24
+ return `https://design-standards.dhamma.org/dist/0.0.28/${path}`
12
25
  }
13
26
 
14
27
  function StylesheetLinkTag({url}) {
@@ -20,6 +33,7 @@ export function VdsFaviconTag() {
20
33
  }
21
34
 
22
35
  export function VdsBootstrapThemeCssTag({ locale, localhost = false }) {
36
+ locale = fixLocale(locale)
23
37
  const url = vdsAssetUrl(`css/bootstrap5-theme${isRtl(locale) ? '.rtl' : ''}.min.css`, localhost)
24
38
  return <>
25
39
  <StylesheetLinkTag url={url}/>
@@ -33,7 +47,7 @@ export function VdsBootstrapThemeJsTag({ localhost = false }) {
33
47
  }
34
48
 
35
49
  export function VdsLogo({locale, disposition = "default", size = '17', tagline = true, dark = false}) {
36
- locale = locale.split("-")[0]
50
+ locale = fixLocale(locale)
37
51
  let trans = i18n[locale] || i18n.en
38
52
 
39
53
  if (disposition == "mobile") {
@@ -55,7 +69,7 @@ export function VdsLogo({locale, disposition = "default", size = '17', tagline =
55
69
  </span>
56
70
  <span className="logo-space">&nbsp;</span>
57
71
  <span>{trans.as_taught}</span>
58
- <span className="vipassana-as-taught">${trans.vipassana_as_taught}</span>
72
+ <span className="vipassana-as-taught">{trans.vipassana_as_taught}</span>
59
73
  </h1>
60
74
  <div className="logo-subtitle">{trans.in_the_tradition}</div>
61
75
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vipassana-design-standards",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Vipassana design standards materials",
5
5
  "homepage": "https://design-standards.dhamma.org",
6
6
  "author": "Dhamma Workers",