Repository navigation
Expand file tree
/
Copy pathlang.js
More file actions
114 lines (111 loc) · 2.61 KB
/
Copy pathlang.js
File metadata and controls
114 lines (111 loc) · 2.61 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const languages = {
en: {
longStrings: {
lessThanAMinute: "less than a minute",
minute: "minute",
hour: "hour",
day: "day",
week: "week",
and: "and",
},
shortStrings: {
lessThanAMinute: "< 1min",
minute: "min",
hour: "hr",
day: "day",
week: "wk",
and: "&",
},
timeLeft: "Time left",
countdownDone: "Countdown done",
inlineNoMinutes: "no minutes",
countingDown: "Counting down",
},
de: {
longStrings: {
lessThanAMinute: "weniger als eine Minute",
minute: "Minute",
minutes: "Minuten",
hour: "Stunde",
hours: "Stunden",
day: "Tag",
days: "Tage",
week: "Woche",
weeks: "Wochen",
and: "und",
},
timeLeft: "Verbleibende Zeit",
countdownDone: "Countdown abgeschlossen",
inlineNoMinutes: "0 Minuten",
},
es: {
longStrings: {
lessThanAMinute: "menos de un minuto",
minute: "minuto",
hour: "hora",
day: "día",
week: "semana",
and: "y",
},
timeLeft: "Tiempo restante",
countdownDone: "Tiempo restante terminado",
inlineNoMinutes: "0 minutos",
},
nl: {
longStrings: {
lessThanAMinute: "minder dan een minuut",
minute: "minuut",
minutes: "minuten",
hour: "uur",
hours: "uren",
day: "dag",
days: "dagen",
week: "week",
weeks: "weken",
and: "en",
},
timeLeft: "Tijd over",
countdownDone: "Aftellen over",
inlineNoMinutes: "0 minuten",
},
tr: {
longStrings: {
lessThanAMinute: "bir dakikadan az",
minute: "dakika",
minutes: "dakika",
hour: "saat",
hours: "saat",
day: "gün",
days: "gün",
week: "hafta",
weeks: "hafta",
and: "ve",
},
timeLeft: "kaldı",
countdownDone: "Geri sayım tamamlandı",
inlineNoMinutes: "0 dakika",
countingDown: "Geri sayım devam ediyor",
},
hu: {
longStrings: {
lessThanAMinute: "Kevesebb, mint egy perc",
minute: "perc",
minutes: "perc",
hour: "óra",
hours: "óra",
day: "nap",
days: "nap",
week: "hét",
weeks: "hét",
and: "és",
},
timeLeft: "hátra lévő idő",
countdownDone: "Visszaszámlálás kész!",
inlineNoMinutes: "0 perc",
countingDown: "visszaszámláló",
},
};
export const availableLanguages = Object.keys(languages);
const getProp = (text, obj) => text.split(".").reduce((obj, val) => obj && obj[val], obj);
export const t = (text, langCode = "en") =>
getProp(text, languages[langCode]) || getProp(text, languages.en);