Skip to content

Commit 113ce77

Browse files
authored
Merge pull request #43 from Sandro642/fix/lang
Refactor language handling by introducing LangType enum and updating …
2 parents 70927d2 + aa06441 commit 113ce77

6 files changed

Lines changed: 49 additions & 44 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'fr.sandro642.github'
8-
version = '0.3.2-STABLE'
8+
version = '0.3.2.1-STABLE'
99

1010
tasks.register('printVersion') {
1111
doLast {

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ And if you thought APIs were complicated, think again! With ConnectLib, it's lik
1717
---
1818

1919
```java
20-
Stable Version: 0.3.2-STABLE
20+
Stable Version: 0.3.2.1-STABLE
2121
```
2222

2323
---
@@ -115,7 +115,7 @@ repositories {
115115

116116
dependencies {
117117

118-
implementation("fr.sandro642.github:ConnectLib:0.3.2-STABLE")
118+
implementation("fr.sandro642.github:ConnectLib:0.3.2.1-STABLE")
119119

120120
}
121121

src/main/java/fr/sandro642/github/ConnectLib.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.sandro642.github;
22

3+
import fr.sandro642.github.enums.LangType;
34
import fr.sandro642.github.enums.MethodType;
45
import fr.sandro642.github.enums.lang.CategoriesType;
56
import fr.sandro642.github.hook.HookManager;
@@ -23,6 +24,8 @@
2324
* @see ConnectLib#YamlUtils()
2425
* @see ConnectLib#MCSupport()
2526
* @see ConnectLib#HookManager()
27+
* @see ConnectLib#LangSupport()
28+
* @see ConnectLib#LangManager()
2629
*/
2730

2831
public class ConnectLib {
@@ -39,7 +42,7 @@ public class ConnectLib {
3942
* @param resourceType the type of resource to initialize
4043
* @param routes the routes to be used in the ConnectLib
4144
*/
42-
public static void initialize(ResourceType resourceType, MethodType.LangType langType, Class<? extends Enum<?>>... routes) {
45+
public static void initialize(ResourceType resourceType, LangType langType, Class<? extends Enum<?>>... routes) {
4346
try {
4447
logger = new Logger();
4548
storeAndRetrieve = new StoreAndRetrieve();
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package fr.sandro642.github.enums;
2+
3+
/**
4+
* LangType is an enumeration representing different language codes used in the ConnectLib library.
5+
*
6+
* @author Sandro642
7+
* @version 1.0
8+
*/
9+
10+
public enum LangType {
11+
ENGLISH("EN_US"),
12+
FRENCH("FR_EU"),
13+
SPANISH("ES_EU"),
14+
GERMAN("DE_EU"),
15+
ITALIAN("IT_EU"),
16+
PORTUGUESE("PT_EU"),
17+
RUSSIAN("RU_RU");
18+
19+
/**
20+
* Language code.
21+
*/
22+
private final String lang;
23+
24+
/**
25+
* Constructor to initialize the language code.
26+
* @param lang
27+
*/
28+
LangType(String lang) {
29+
this.lang = lang;
30+
}
31+
32+
/**
33+
* Get the language code.
34+
* @return the language code string
35+
*/
36+
public String getLang() {
37+
return lang;
38+
}
39+
}

src/main/java/fr/sandro642/github/enums/MethodType.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,4 @@ public enum MethodType {
1919
MethodType(String typeMethod) {
2020
this.type = typeMethod;
2121
}
22-
23-
/**
24-
* LangType is an enumeration representing different language codes used in the ConnectLib library.
25-
*
26-
* @author Sandro642
27-
* @version 1.0
28-
*/
29-
30-
public enum LangType {
31-
ENGLISH("EN_US"),
32-
FRENCH("FR_EU"),
33-
SPANISH("ES_EU"),
34-
GERMAN("DE_EU"),
35-
ITALIAN("IT_EU"),
36-
PORTUGUESE("PT_EU"),
37-
RUSSIAN("RU_RU");
38-
39-
/**
40-
* Language code.
41-
*/
42-
private final String lang;
43-
44-
/**
45-
* Constructor to initialize the language code.
46-
* @param lang
47-
*/
48-
LangType(String lang) {
49-
this.lang = lang;
50-
}
51-
52-
/**
53-
* Get the language code.
54-
* @return the language code string
55-
*/
56-
public String getLang() {
57-
return lang;
58-
}
59-
}
6022
}

src/main/java/fr/sandro642/github/hook/LangSupport.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fr.sandro642.github.hook;
22

33
import fr.sandro642.github.ConnectLib;
4+
import fr.sandro642.github.enums.LangType;
45
import fr.sandro642.github.enums.MethodType;
56
import fr.sandro642.github.enums.lang.CategoriesType;
67

@@ -23,14 +24,14 @@ public class LangSupport {
2324
* Private singleton langType.
2425
* @return langTypeSingleton
2526
*/
26-
private MethodType.LangType langTypeSingleton;
27+
private LangType langTypeSingleton;
2728

2829
/**
2930
* Sets the LangType variable for this instance.
3031
* @param langType The language type to set. Must not be null.
3132
* @return The LangType that was set.
3233
*/
33-
public MethodType.LangType setLangTypeVariable(MethodType.LangType langType) {
34+
public LangType setLangTypeVariable(LangType langType) {
3435
if (langType == null) {
3536
ConnectLib.Logger().ERROR(ConnectLib.LangManager().getMessage(CategoriesType.LANGSUPPORT_CLASS, "general.illegalarg"));
3637

0 commit comments

Comments
 (0)