stackping-i18n 0.0.0-stage → 0.1.2
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/README.md +46 -2
- package/dist/index.cjs +825 -0
- package/dist/index.d.cts +266 -0
- package/dist/index.d.ts +266 -0
- package/dist/index.js +791 -0
- package/package.json +45 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
interface Resources {
|
|
2
|
+
common: {
|
|
3
|
+
appName: string;
|
|
4
|
+
tagline: string;
|
|
5
|
+
skipToContent: string;
|
|
6
|
+
nav: {
|
|
7
|
+
jobs: string;
|
|
8
|
+
myApplications: string;
|
|
9
|
+
saved: string;
|
|
10
|
+
forCompanies: string;
|
|
11
|
+
profile: string;
|
|
12
|
+
admin: string;
|
|
13
|
+
};
|
|
14
|
+
actions: {
|
|
15
|
+
save: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
delete: string;
|
|
18
|
+
edit: string;
|
|
19
|
+
add: string;
|
|
20
|
+
back: string;
|
|
21
|
+
next: string;
|
|
22
|
+
showMore: string;
|
|
23
|
+
resetFilters: string;
|
|
24
|
+
share: string;
|
|
25
|
+
report: string;
|
|
26
|
+
};
|
|
27
|
+
languages: {
|
|
28
|
+
az: string;
|
|
29
|
+
en: string;
|
|
30
|
+
ru: string;
|
|
31
|
+
};
|
|
32
|
+
workModes: {
|
|
33
|
+
remote: string;
|
|
34
|
+
hybrid: string;
|
|
35
|
+
onsite: string;
|
|
36
|
+
};
|
|
37
|
+
time: {
|
|
38
|
+
justNow: string;
|
|
39
|
+
minutesAgo_one: string;
|
|
40
|
+
minutesAgo_other: string;
|
|
41
|
+
hoursAgo_one: string;
|
|
42
|
+
hoursAgo_other: string;
|
|
43
|
+
daysAgo_one: string;
|
|
44
|
+
daysAgo_other: string;
|
|
45
|
+
};
|
|
46
|
+
autosaved: string;
|
|
47
|
+
};
|
|
48
|
+
auth: {
|
|
49
|
+
signUp: {
|
|
50
|
+
title: string;
|
|
51
|
+
submit: string;
|
|
52
|
+
haveAccount: string;
|
|
53
|
+
consent: string;
|
|
54
|
+
};
|
|
55
|
+
logIn: {
|
|
56
|
+
title: string;
|
|
57
|
+
submit: string;
|
|
58
|
+
noAccount: string;
|
|
59
|
+
forgotPassword: string;
|
|
60
|
+
};
|
|
61
|
+
logOut: string;
|
|
62
|
+
logOutEverywhere: string;
|
|
63
|
+
fields: {
|
|
64
|
+
email: string;
|
|
65
|
+
password: string;
|
|
66
|
+
newPassword: string;
|
|
67
|
+
code: string;
|
|
68
|
+
};
|
|
69
|
+
verify: {
|
|
70
|
+
title: string;
|
|
71
|
+
sent: string;
|
|
72
|
+
submit: string;
|
|
73
|
+
resend: string;
|
|
74
|
+
};
|
|
75
|
+
reset: {
|
|
76
|
+
title: string;
|
|
77
|
+
sent: string;
|
|
78
|
+
submit: string;
|
|
79
|
+
done: string;
|
|
80
|
+
};
|
|
81
|
+
passwordHint: string;
|
|
82
|
+
};
|
|
83
|
+
profile: {
|
|
84
|
+
title: string;
|
|
85
|
+
completeness: string;
|
|
86
|
+
remaining: string;
|
|
87
|
+
sections: {
|
|
88
|
+
basic: string;
|
|
89
|
+
skills: string;
|
|
90
|
+
experience: string;
|
|
91
|
+
languages: string;
|
|
92
|
+
cv: string;
|
|
93
|
+
alerts: string;
|
|
94
|
+
privacy: string;
|
|
95
|
+
};
|
|
96
|
+
fields: {
|
|
97
|
+
fullName: string;
|
|
98
|
+
headline: string;
|
|
99
|
+
city: string;
|
|
100
|
+
workModes: string;
|
|
101
|
+
skillExperience: string;
|
|
102
|
+
company: string;
|
|
103
|
+
role: string;
|
|
104
|
+
from: string;
|
|
105
|
+
to: string;
|
|
106
|
+
current: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
totalExperience: string;
|
|
110
|
+
addSkill: string;
|
|
111
|
+
addExperience: string;
|
|
112
|
+
addLanguage: string;
|
|
113
|
+
cv: {
|
|
114
|
+
upload: string;
|
|
115
|
+
replace: string;
|
|
116
|
+
view: string;
|
|
117
|
+
hint: string;
|
|
118
|
+
};
|
|
119
|
+
privacy: {
|
|
120
|
+
searchable: string;
|
|
121
|
+
searchableHint: string;
|
|
122
|
+
export: string;
|
|
123
|
+
deleteAccount: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
jobs: {
|
|
127
|
+
feedTitle: string;
|
|
128
|
+
feedSubtitle: string;
|
|
129
|
+
count_one: string;
|
|
130
|
+
count_other: string;
|
|
131
|
+
shown: string;
|
|
132
|
+
searchPlaceholder: string;
|
|
133
|
+
sort: {
|
|
134
|
+
label: string;
|
|
135
|
+
fit: string;
|
|
136
|
+
newest: string;
|
|
137
|
+
};
|
|
138
|
+
filters: {
|
|
139
|
+
title: string;
|
|
140
|
+
minFit: string;
|
|
141
|
+
workMode: string;
|
|
142
|
+
city: string;
|
|
143
|
+
level: string;
|
|
144
|
+
source: string;
|
|
145
|
+
native: string;
|
|
146
|
+
external: string;
|
|
147
|
+
};
|
|
148
|
+
fit: {
|
|
149
|
+
label: string;
|
|
150
|
+
high: string;
|
|
151
|
+
medium: string;
|
|
152
|
+
low: string;
|
|
153
|
+
outOf: string;
|
|
154
|
+
};
|
|
155
|
+
legend: {
|
|
156
|
+
have: string;
|
|
157
|
+
missingMust: string;
|
|
158
|
+
missingNice: string;
|
|
159
|
+
};
|
|
160
|
+
verifiedCompany: string;
|
|
161
|
+
openOnSource: string;
|
|
162
|
+
viewRequirements: string;
|
|
163
|
+
apply: string;
|
|
164
|
+
empty: {
|
|
165
|
+
title: string;
|
|
166
|
+
body: string;
|
|
167
|
+
};
|
|
168
|
+
sourceNote: string;
|
|
169
|
+
};
|
|
170
|
+
skills: {
|
|
171
|
+
suggest: string;
|
|
172
|
+
suggestHint: string;
|
|
173
|
+
notInCatalog: string;
|
|
174
|
+
alias: string;
|
|
175
|
+
status: {
|
|
176
|
+
active: string;
|
|
177
|
+
suggested: string;
|
|
178
|
+
merged: string;
|
|
179
|
+
rejected: string;
|
|
180
|
+
};
|
|
181
|
+
admin: {
|
|
182
|
+
title: string;
|
|
183
|
+
approve: string;
|
|
184
|
+
reject: string;
|
|
185
|
+
merge: string;
|
|
186
|
+
aliases: string;
|
|
187
|
+
category: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
errors: {
|
|
191
|
+
internal: string;
|
|
192
|
+
badRequest: string;
|
|
193
|
+
unauthorized: string;
|
|
194
|
+
forbidden: string;
|
|
195
|
+
notFound: string;
|
|
196
|
+
tooManyRequests: string;
|
|
197
|
+
invalidCredentials: string;
|
|
198
|
+
emailNotVerified: string;
|
|
199
|
+
codeInvalid: string;
|
|
200
|
+
codeExpired: string;
|
|
201
|
+
sessionExpired: string;
|
|
202
|
+
skillNotFound: string;
|
|
203
|
+
cvTooLarge: string;
|
|
204
|
+
cvBadType: string;
|
|
205
|
+
};
|
|
206
|
+
validation: {
|
|
207
|
+
required: string;
|
|
208
|
+
email: string;
|
|
209
|
+
minLength: string;
|
|
210
|
+
maxLength: string;
|
|
211
|
+
maxItems: string;
|
|
212
|
+
oneOf: string;
|
|
213
|
+
passwordWeak: string;
|
|
214
|
+
};
|
|
215
|
+
email: {
|
|
216
|
+
verify: {
|
|
217
|
+
subject: string;
|
|
218
|
+
body: string;
|
|
219
|
+
};
|
|
220
|
+
reset: {
|
|
221
|
+
subject: string;
|
|
222
|
+
body: string;
|
|
223
|
+
};
|
|
224
|
+
accountExists: {
|
|
225
|
+
subject: string;
|
|
226
|
+
body: string;
|
|
227
|
+
};
|
|
228
|
+
footer: string;
|
|
229
|
+
};
|
|
230
|
+
bot: {
|
|
231
|
+
linkSite: string;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare const LANGUAGES: readonly ["az", "en", "ru"];
|
|
236
|
+
type Language = (typeof LANGUAGES)[number];
|
|
237
|
+
declare const DEFAULT_LANG: Language;
|
|
238
|
+
/** i18next-shaped: `resources[lang][namespace]`. */
|
|
239
|
+
declare const resources: Readonly<Record<Language, Resources>>;
|
|
240
|
+
type Namespace = keyof Resources;
|
|
241
|
+
declare const NAMESPACES: Namespace[];
|
|
242
|
+
declare const DEFAULT_NAMESPACE: Namespace;
|
|
243
|
+
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
244
|
+
type Leaves<T, P extends string = ''> = {
|
|
245
|
+
[K in keyof T & string]: T[K] extends string ? `${P}${K}` : Leaves<T[K], `${P}${K}.`>;
|
|
246
|
+
}[keyof T & string];
|
|
247
|
+
type StripPlural<K extends string> = K extends `${infer B}_${PluralSuffix}` ? B : K;
|
|
248
|
+
/** Full dotted path, namespace first, plural suffix removed: `jobs.count`, `auth.logIn.title`. */
|
|
249
|
+
type TranslationKey = StripPlural<Leaves<Resources>>;
|
|
250
|
+
type TranslationParams = Readonly<Record<string, string | number>>;
|
|
251
|
+
type Translate = (key: TranslationKey, params?: TranslationParams) => string;
|
|
252
|
+
declare const isLanguage: (value: unknown) => value is Language;
|
|
253
|
+
/**
|
|
254
|
+
* Picks the best supported language from an `Accept-Language` header (or a bare tag), honouring
|
|
255
|
+
* q-values; falls back to `DEFAULT_LANG`. Input is untrusted, so it is length-capped and parsed
|
|
256
|
+
* leniently: anything odd simply does not match.
|
|
257
|
+
*/
|
|
258
|
+
declare function resolveLanguage(header: string | null | undefined): Language;
|
|
259
|
+
/**
|
|
260
|
+
* A dependency-free `t()` for the backend (API errors, emails, later the bot). The client uses
|
|
261
|
+
* i18next with `resources` instead. Fallback: the language → `DEFAULT_LANG` → English → the key
|
|
262
|
+
* itself (never throws, never returns an empty string). A `count` param selects the plural form.
|
|
263
|
+
*/
|
|
264
|
+
declare function createTranslator(lang: Language): Translate;
|
|
265
|
+
|
|
266
|
+
export { DEFAULT_LANG, DEFAULT_NAMESPACE, LANGUAGES, type Language, NAMESPACES, type Namespace, type Resources, type Translate, type TranslationKey, type TranslationParams, createTranslator, isLanguage, resolveLanguage, resources };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
interface Resources {
|
|
2
|
+
common: {
|
|
3
|
+
appName: string;
|
|
4
|
+
tagline: string;
|
|
5
|
+
skipToContent: string;
|
|
6
|
+
nav: {
|
|
7
|
+
jobs: string;
|
|
8
|
+
myApplications: string;
|
|
9
|
+
saved: string;
|
|
10
|
+
forCompanies: string;
|
|
11
|
+
profile: string;
|
|
12
|
+
admin: string;
|
|
13
|
+
};
|
|
14
|
+
actions: {
|
|
15
|
+
save: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
delete: string;
|
|
18
|
+
edit: string;
|
|
19
|
+
add: string;
|
|
20
|
+
back: string;
|
|
21
|
+
next: string;
|
|
22
|
+
showMore: string;
|
|
23
|
+
resetFilters: string;
|
|
24
|
+
share: string;
|
|
25
|
+
report: string;
|
|
26
|
+
};
|
|
27
|
+
languages: {
|
|
28
|
+
az: string;
|
|
29
|
+
en: string;
|
|
30
|
+
ru: string;
|
|
31
|
+
};
|
|
32
|
+
workModes: {
|
|
33
|
+
remote: string;
|
|
34
|
+
hybrid: string;
|
|
35
|
+
onsite: string;
|
|
36
|
+
};
|
|
37
|
+
time: {
|
|
38
|
+
justNow: string;
|
|
39
|
+
minutesAgo_one: string;
|
|
40
|
+
minutesAgo_other: string;
|
|
41
|
+
hoursAgo_one: string;
|
|
42
|
+
hoursAgo_other: string;
|
|
43
|
+
daysAgo_one: string;
|
|
44
|
+
daysAgo_other: string;
|
|
45
|
+
};
|
|
46
|
+
autosaved: string;
|
|
47
|
+
};
|
|
48
|
+
auth: {
|
|
49
|
+
signUp: {
|
|
50
|
+
title: string;
|
|
51
|
+
submit: string;
|
|
52
|
+
haveAccount: string;
|
|
53
|
+
consent: string;
|
|
54
|
+
};
|
|
55
|
+
logIn: {
|
|
56
|
+
title: string;
|
|
57
|
+
submit: string;
|
|
58
|
+
noAccount: string;
|
|
59
|
+
forgotPassword: string;
|
|
60
|
+
};
|
|
61
|
+
logOut: string;
|
|
62
|
+
logOutEverywhere: string;
|
|
63
|
+
fields: {
|
|
64
|
+
email: string;
|
|
65
|
+
password: string;
|
|
66
|
+
newPassword: string;
|
|
67
|
+
code: string;
|
|
68
|
+
};
|
|
69
|
+
verify: {
|
|
70
|
+
title: string;
|
|
71
|
+
sent: string;
|
|
72
|
+
submit: string;
|
|
73
|
+
resend: string;
|
|
74
|
+
};
|
|
75
|
+
reset: {
|
|
76
|
+
title: string;
|
|
77
|
+
sent: string;
|
|
78
|
+
submit: string;
|
|
79
|
+
done: string;
|
|
80
|
+
};
|
|
81
|
+
passwordHint: string;
|
|
82
|
+
};
|
|
83
|
+
profile: {
|
|
84
|
+
title: string;
|
|
85
|
+
completeness: string;
|
|
86
|
+
remaining: string;
|
|
87
|
+
sections: {
|
|
88
|
+
basic: string;
|
|
89
|
+
skills: string;
|
|
90
|
+
experience: string;
|
|
91
|
+
languages: string;
|
|
92
|
+
cv: string;
|
|
93
|
+
alerts: string;
|
|
94
|
+
privacy: string;
|
|
95
|
+
};
|
|
96
|
+
fields: {
|
|
97
|
+
fullName: string;
|
|
98
|
+
headline: string;
|
|
99
|
+
city: string;
|
|
100
|
+
workModes: string;
|
|
101
|
+
skillExperience: string;
|
|
102
|
+
company: string;
|
|
103
|
+
role: string;
|
|
104
|
+
from: string;
|
|
105
|
+
to: string;
|
|
106
|
+
current: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
totalExperience: string;
|
|
110
|
+
addSkill: string;
|
|
111
|
+
addExperience: string;
|
|
112
|
+
addLanguage: string;
|
|
113
|
+
cv: {
|
|
114
|
+
upload: string;
|
|
115
|
+
replace: string;
|
|
116
|
+
view: string;
|
|
117
|
+
hint: string;
|
|
118
|
+
};
|
|
119
|
+
privacy: {
|
|
120
|
+
searchable: string;
|
|
121
|
+
searchableHint: string;
|
|
122
|
+
export: string;
|
|
123
|
+
deleteAccount: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
jobs: {
|
|
127
|
+
feedTitle: string;
|
|
128
|
+
feedSubtitle: string;
|
|
129
|
+
count_one: string;
|
|
130
|
+
count_other: string;
|
|
131
|
+
shown: string;
|
|
132
|
+
searchPlaceholder: string;
|
|
133
|
+
sort: {
|
|
134
|
+
label: string;
|
|
135
|
+
fit: string;
|
|
136
|
+
newest: string;
|
|
137
|
+
};
|
|
138
|
+
filters: {
|
|
139
|
+
title: string;
|
|
140
|
+
minFit: string;
|
|
141
|
+
workMode: string;
|
|
142
|
+
city: string;
|
|
143
|
+
level: string;
|
|
144
|
+
source: string;
|
|
145
|
+
native: string;
|
|
146
|
+
external: string;
|
|
147
|
+
};
|
|
148
|
+
fit: {
|
|
149
|
+
label: string;
|
|
150
|
+
high: string;
|
|
151
|
+
medium: string;
|
|
152
|
+
low: string;
|
|
153
|
+
outOf: string;
|
|
154
|
+
};
|
|
155
|
+
legend: {
|
|
156
|
+
have: string;
|
|
157
|
+
missingMust: string;
|
|
158
|
+
missingNice: string;
|
|
159
|
+
};
|
|
160
|
+
verifiedCompany: string;
|
|
161
|
+
openOnSource: string;
|
|
162
|
+
viewRequirements: string;
|
|
163
|
+
apply: string;
|
|
164
|
+
empty: {
|
|
165
|
+
title: string;
|
|
166
|
+
body: string;
|
|
167
|
+
};
|
|
168
|
+
sourceNote: string;
|
|
169
|
+
};
|
|
170
|
+
skills: {
|
|
171
|
+
suggest: string;
|
|
172
|
+
suggestHint: string;
|
|
173
|
+
notInCatalog: string;
|
|
174
|
+
alias: string;
|
|
175
|
+
status: {
|
|
176
|
+
active: string;
|
|
177
|
+
suggested: string;
|
|
178
|
+
merged: string;
|
|
179
|
+
rejected: string;
|
|
180
|
+
};
|
|
181
|
+
admin: {
|
|
182
|
+
title: string;
|
|
183
|
+
approve: string;
|
|
184
|
+
reject: string;
|
|
185
|
+
merge: string;
|
|
186
|
+
aliases: string;
|
|
187
|
+
category: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
errors: {
|
|
191
|
+
internal: string;
|
|
192
|
+
badRequest: string;
|
|
193
|
+
unauthorized: string;
|
|
194
|
+
forbidden: string;
|
|
195
|
+
notFound: string;
|
|
196
|
+
tooManyRequests: string;
|
|
197
|
+
invalidCredentials: string;
|
|
198
|
+
emailNotVerified: string;
|
|
199
|
+
codeInvalid: string;
|
|
200
|
+
codeExpired: string;
|
|
201
|
+
sessionExpired: string;
|
|
202
|
+
skillNotFound: string;
|
|
203
|
+
cvTooLarge: string;
|
|
204
|
+
cvBadType: string;
|
|
205
|
+
};
|
|
206
|
+
validation: {
|
|
207
|
+
required: string;
|
|
208
|
+
email: string;
|
|
209
|
+
minLength: string;
|
|
210
|
+
maxLength: string;
|
|
211
|
+
maxItems: string;
|
|
212
|
+
oneOf: string;
|
|
213
|
+
passwordWeak: string;
|
|
214
|
+
};
|
|
215
|
+
email: {
|
|
216
|
+
verify: {
|
|
217
|
+
subject: string;
|
|
218
|
+
body: string;
|
|
219
|
+
};
|
|
220
|
+
reset: {
|
|
221
|
+
subject: string;
|
|
222
|
+
body: string;
|
|
223
|
+
};
|
|
224
|
+
accountExists: {
|
|
225
|
+
subject: string;
|
|
226
|
+
body: string;
|
|
227
|
+
};
|
|
228
|
+
footer: string;
|
|
229
|
+
};
|
|
230
|
+
bot: {
|
|
231
|
+
linkSite: string;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare const LANGUAGES: readonly ["az", "en", "ru"];
|
|
236
|
+
type Language = (typeof LANGUAGES)[number];
|
|
237
|
+
declare const DEFAULT_LANG: Language;
|
|
238
|
+
/** i18next-shaped: `resources[lang][namespace]`. */
|
|
239
|
+
declare const resources: Readonly<Record<Language, Resources>>;
|
|
240
|
+
type Namespace = keyof Resources;
|
|
241
|
+
declare const NAMESPACES: Namespace[];
|
|
242
|
+
declare const DEFAULT_NAMESPACE: Namespace;
|
|
243
|
+
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
244
|
+
type Leaves<T, P extends string = ''> = {
|
|
245
|
+
[K in keyof T & string]: T[K] extends string ? `${P}${K}` : Leaves<T[K], `${P}${K}.`>;
|
|
246
|
+
}[keyof T & string];
|
|
247
|
+
type StripPlural<K extends string> = K extends `${infer B}_${PluralSuffix}` ? B : K;
|
|
248
|
+
/** Full dotted path, namespace first, plural suffix removed: `jobs.count`, `auth.logIn.title`. */
|
|
249
|
+
type TranslationKey = StripPlural<Leaves<Resources>>;
|
|
250
|
+
type TranslationParams = Readonly<Record<string, string | number>>;
|
|
251
|
+
type Translate = (key: TranslationKey, params?: TranslationParams) => string;
|
|
252
|
+
declare const isLanguage: (value: unknown) => value is Language;
|
|
253
|
+
/**
|
|
254
|
+
* Picks the best supported language from an `Accept-Language` header (or a bare tag), honouring
|
|
255
|
+
* q-values; falls back to `DEFAULT_LANG`. Input is untrusted, so it is length-capped and parsed
|
|
256
|
+
* leniently: anything odd simply does not match.
|
|
257
|
+
*/
|
|
258
|
+
declare function resolveLanguage(header: string | null | undefined): Language;
|
|
259
|
+
/**
|
|
260
|
+
* A dependency-free `t()` for the backend (API errors, emails, later the bot). The client uses
|
|
261
|
+
* i18next with `resources` instead. Fallback: the language → `DEFAULT_LANG` → English → the key
|
|
262
|
+
* itself (never throws, never returns an empty string). A `count` param selects the plural form.
|
|
263
|
+
*/
|
|
264
|
+
declare function createTranslator(lang: Language): Translate;
|
|
265
|
+
|
|
266
|
+
export { DEFAULT_LANG, DEFAULT_NAMESPACE, LANGUAGES, type Language, NAMESPACES, type Namespace, type Resources, type Translate, type TranslationKey, type TranslationParams, createTranslator, isLanguage, resolveLanguage, resources };
|