๐Ÿ“ฆ manideepk90 / hyperswitch-common-code-base

๐Ÿ“„ LocaleStringHelper.res ยท 79 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79open LocaleStringTypes
let mapLocalStringToTypeLocale = val => {
  switch val {
  | "he" => He
  | "fr" => Fr
  | "en-GB" => En_GB
  | "ar" => Ar
  | "ja" => Ja
  | "de" => De
  | "fr-BE" => Fr_BE
  | "es" => Es
  | "ca" => Ca
  | "zh" => Zh
  | "pt" => Pt
  | "it" => It
  | "pl" => Pl
  | "nl" => Nl
  | "sv" => Sv
  | "ru" => Ru
  | "ni-be" => Ni_BE
  | "lt" => Lt
  | "cs" => Cs
  | "sk" => Sk
  | "ls" => Ls
  | "cy" => Cy
  | "el" => El
  | "et" => Et
  | "fi" => Fi
  | "nb" => Nb
  | "bs" => Bs
  | "da" => Da
  | "ms" => Ms
  | "tr-c" => Tr_C
  | "en"
  | _ =>
    En
  }
}

let getLocale = locale => {
  try {
    switch locale->Option.getOr(En) {
    | En => EnglishLocale.localeStrings
    | He => HebrewLocale.localeStrings
    | Fr => FrenchLocale.localeStrings
    | En_GB => EnglishGBLocale.localeStrings
    | Ar => ArabicLocale.localeStrings
    | Ja => JapaneseLocale.localeStrings
    | De => DeutschLocale.localeStrings
    | Fr_BE => FrenchBelgiumLocale.localeStrings
    | Es => SpanishLocale.localeStrings
    | Ca => CatalanLocale.localeStrings
    | Zh => ChineseLocale.localeStrings
    | Pt => PortugueseLocale.localeStrings
    | It => ItalianLocale.localeStrings
    | Pl => PolishLocale.localeStrings
    | Nl => DutchLocale.localeStrings
    | Sv => SwedishLocale.localeStrings
    | Ru => RussianLocale.localeStrings
    | Ni_BE => DutchBelgiumLocale.localeStrings
    | Lt => LithuanianLocale.localeStrings
    | Cs => CzechLocale.localeStrings
    | Sk => SlovakLocale.localeStrings
    | Ls => IcelandicLocale.localeStrings
    | Cy => WelshLocale.localeStrings
    | El => GreekLocale.localeStrings
    | Et => EstonianLocale.localeStrings
    | Fi => FinnishLocale.localeStrings
    | Nb => NorwegianLocale.localeStrings
    | Bs => BosnianLocale.localeStrings
    | Da => DanishLocale.localeStrings
    | Ms => MalayLocale.localeStrings
    | Tr_C => TurkishLocale.localeStrings
    }
  } catch {
  | _ => EnglishLocale.localeStrings
  }
}