-
Notifications
You must be signed in to change notification settings - Fork 6
/
strings.ts
50 lines (43 loc) · 1.03 KB
/
strings.ts
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
import toTitleCase from "title";
export enum StringCase {
TITLE,
UPPER,
LOWER,
SOURCE,
}
const _en_us = {
AniListAuthAttribution: "via AniList",
tagline: "An anime tracking app powered by AniList and Expo.",
logIn: "Log in",
signUp: "Sign up",
anime: "anime",
airing: "airing",
history: "history",
broadcastHistory: "Broadcast history",
discover: "discover",
profile: "profile",
details: "details",
settings: "settings",
goodweebs: "Goodweebs",
};
type StringNames = keyof typeof _en_us;
type StringDefinitions = {
[p in StringNames]: string;
};
export const en_us: StringDefinitions = _en_us;
export function getString(
stringName: StringNames,
stringCase: StringCase = StringCase.SOURCE
) {
const stringText = en_us[stringName];
switch (stringCase) {
case StringCase.UPPER:
return stringText.toLocaleUpperCase();
case StringCase.LOWER:
return stringText.toLocaleLowerCase();
case StringCase.TITLE:
return toTitleCase(stringText);
default:
return stringText;
}
}