summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/localization/LineId.java
blob: 23eedc106529fab9dc0cac32fb83a6a85cb88328 (plain)
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
package kz.ilotterytea.maxon.localization;

import org.slf4j.LoggerFactory;

import java.util.Locale;

public enum LineId {
    UpdaterInfo,

    MenuNewgame,
    MenuContinue,
    MenuReset,

    SoundsTitle,
    SoundsMusic,
    SoundsSfx,

    CreditsTitle,
    CreditsMaxon,
    CreditsDeveloper,
    CreditsContributor,
    CreditsMusic,
    CreditsIdea,
    CreditsTester,
    CreditsMoral,

    LoginTitle,
    LoginUsername,
    LoginPassword,
    LoginRegister,
    LoginSend,
    LoginProcessing,
    LoginButton,
    LoginAuthorised,

    GiftboxOpen,

    MinigameSlotsSpinbutton,
    MinigameSlotsExitbutton,
    MinigameSlotsBet,
    MinigameSlotsNothing,
    MinigameSlotsPrize,

    StoreTitle,
    StoreBuy,
    StoreSell,
    StoreX1,
    StoreX10,
    StorePetlocked,

    PetBrorName,
    PetBrorDesc,
    PetSandwichName,
    PetSandwichDesc,
    PetManlooshkaName,
    PetManlooshkaDesc,
    PetThirstyName,
    PetThirstyDesc,
    PetFuriosName,
    PetFuriosDesc,
    PetTvcatName,
    PetTvcatDesc,
    PetProgcatName,
    PetProgcatDesc,
    PetScreamcatName,
    PetScreamcatDesc,
    PetHellcatName,
    PetHellcatDesc,
    PetLurkerName,
    PetLurkerDesc,
    PetPianoName,
    PetPianoDesc,
    PetBeeName,
    PetBeeDesc,
    PetBusyName,
    PetBusyDesc,
    PetAeaeName,
    PetAeaeDesc,
    PetSuccatName,
    PetSuccatDesc,
    ;

    public static LineId fromJson(String value) {
        StringBuilder result = new StringBuilder();
        String[] chunks = value.split("\\.");

        for (String chunk : chunks) {
            chunk = chunk.replace("_", "");

            String firstLetter = chunk.substring(0, 1).toUpperCase(Locale.ROOT);
            String otherPart = chunk.substring(1);

            result.append(firstLetter).append(otherPart);
        }

        value = result.toString();

        try {
            return LineId.valueOf(value);
        } catch (Exception e) {
            LoggerFactory.getLogger(LineId.class.getName()).error("The key '{}' not registered in LineId enum", value);
            return null;
        }
    }
}