Skip to content

Commit 80be83b

Browse files
authored
Merge pull request #40 from Sandro642/feature/lang
Feature/lang
2 parents 346944a + df9c9da commit 80be83b

12 files changed

Lines changed: 153 additions & 168 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.0-STABLE'
8+
version = '0.3.1-STABLE'
99

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

readme.md

Lines changed: 6 additions & 6 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.0-STABLE
20+
Stable Version: 0.3.1-STABLE
2121
```
2222

2323
---
@@ -27,23 +27,23 @@ Support Lib : Java 23
2727
2828
Hook -----------------------|
2929
- Support Minecraft 1.16 - Latest Version
30-
- Support LangType 0.1.0 - Latest Version
30+
- Support LangType 2.0 - Latest Version
3131
3232
- Coming Soon.
3333
```
3434
---
3535
## LangManager
3636
```
37-
EN : Released - Latest Version
38-
FR : Sorti - Dernière Version
37+
EN : Released - Version 0.1.1
38+
FR : Sorti - Version 0.1.0
3939
```
4040

4141
---
4242

4343
Stay informed about the latest features and updates of ConnectLib.
4444

4545
- Advanced debugging system. Available soon.
46-
46+
[readme.md](readme.md)
4747
---
4848

4949
Changelog:
@@ -115,7 +115,7 @@ repositories {
115115

116116
dependencies {
117117

118-
implementation("fr.sandro642.github:ConnectLib:0.3.0-STABLE")
118+
implementation("fr.sandro642.github:ConnectLib:0.3.1-STABLE")
119119

120120
}
121121

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

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

3-
import fr.sandro642.github.enums.LangType;
3+
import fr.sandro642.github.enums.MethodType;
4+
import fr.sandro642.github.enums.lang.CategoriesType;
45
import fr.sandro642.github.hook.HookManager;
56
import fr.sandro642.github.hook.LangSupport;
67
import fr.sandro642.github.hook.MCSupport;
@@ -38,7 +39,7 @@ public class ConnectLib {
3839
* @param resourceType the type of resource to initialize
3940
* @param routes the routes to be used in the ConnectLib
4041
*/
41-
public static void initialize(ResourceType resourceType, LangType langType, Class<? extends Enum<?>>... routes) {
42+
public static void initialize(ResourceType resourceType, MethodType.LangType langType, Class<? extends Enum<?>>... routes) {
4243
try {
4344
logger = new Logger();
4445
storeAndRetrieve = new StoreAndRetrieve();
@@ -54,7 +55,7 @@ public static void initialize(ResourceType resourceType, LangType langType, Clas
5455
Map<Enum<?>, String> routesEnums = new HashMap<>();
5556
for (Class<? extends Enum<?>> route : routes) {
5657
if (route == null) {
57-
ConnectLib.Logger().ERROR(langManager.getMessage("connectlib.class", "initialise.routeclass"));
58+
ConnectLib.Logger().ERROR(langManager.getMessage(CategoriesType.CONNECTLIB_CLASS, "initialise.routeclass"));
5859
continue;
5960
}
6061
routesEnums.putAll(EnumLoader.convertRouteImport(route));
@@ -73,7 +74,7 @@ public static void initialize(ResourceType resourceType, LangType langType, Clas
7374
ConnectLib.routes.putAll(yamlRoutes);
7475
}
7576
} catch (Exception e) {
76-
ConnectLib.Logger().ERROR(langManager.getMessage("connectlib.class", "initialise.catcherror", Map.of("exception", e.getMessage())));
77+
ConnectLib.Logger().ERROR(langManager.getMessage(CategoriesType.CONNECTLIB_CLASS, "initialise.catcherror", Map.of("exception", e.getMessage())));
7778
}
7879
}
7980

@@ -86,7 +87,7 @@ public static String getRoute(String routeName) {
8687
if (routes.containsKey(routeName)) {
8788
return routes.get(routeName);
8889
} else {
89-
ConnectLib.Logger().ERROR(langManager.getMessage("connectlib.class", "getroute.error", Map.of("route", routeName)));
90+
ConnectLib.Logger().ERROR(langManager.getMessage(CategoriesType.CONNECTLIB_CLASS, "getroute.error", Map.of("route", routeName)));
9091
return null;
9192
}
9293
}

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

Lines changed: 0 additions & 39 deletions
This file was deleted.

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,42 @@ 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+
}
2260
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package fr.sandro642.github.enums.lang;
2+
3+
/**
4+
* CategoriesType is an enumeration representing different categories used in the ConnectLib library.
5+
*
6+
* @author Sandro642
7+
* @version 1.0
8+
*/
9+
10+
public enum CategoriesType {
11+
12+
/**
13+
* Category for ConnectLib class files.
14+
*/
15+
CONNECTLIB_CLASS("connectlib.class"),
16+
ANNOTATION_PACKAGE("annotation.package"),
17+
YAMLUTILS_CLASS("yamlutils.class")
18+
;
19+
20+
/**
21+
* Category for Enums files.
22+
*/
23+
private final String category;
24+
25+
/**
26+
* Constructor to initialize the category.
27+
* @param category
28+
*/
29+
CategoriesType(String category) {
30+
this.category = category;
31+
}
32+
33+
/**
34+
* Get the category.
35+
* @return the category string
36+
*/
37+
public String getCategory() {
38+
return category;
39+
}
40+
}

src/main/java/fr/sandro642/github/example/ExampleUsages.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import fr.sandro642.github.ConnectLib;
44
import fr.sandro642.github.api.ApiFactory;
5-
import fr.sandro642.github.enums.LangType;
65
import fr.sandro642.github.enums.MethodType;
76
import fr.sandro642.github.enums.ResourceType;
87
import fr.sandro642.github.enums.VersionType;
@@ -41,9 +40,9 @@ public String route() {
4140
public void initializeLib() {
4241

4342
// Optionally, you can specify routes if needed
44-
ConnectLib.initialize(ResourceType.MAIN_RESOURCES, LangType.FRENCH, ExampleRoutes.class);
43+
ConnectLib.initialize(ResourceType.MAIN_RESOURCES, MethodType.LangType.FRENCH, ExampleRoutes.class);
4544
// You can also initialize without specifying routes
46-
ConnectLib.initialize(ResourceType.MAIN_RESOURCES, LangType.FRENCH);
45+
ConnectLib.initialize(ResourceType.MAIN_RESOURCES, MethodType.LangType.FRENCH);
4746
}
4847

4948
// Add methods here to demonstrate how to use the ConnectLib library

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

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

3-
import fr.sandro642.github.ConnectLib;
4-
import fr.sandro642.github.enums.LangType;
3+
import fr.sandro642.github.enums.MethodType;
54

65
/**
76
* LangSupport is a placeholder class for future language support implementations.
@@ -27,14 +26,14 @@ public class LangSupport {
2726
* Private singleton langType.
2827
* @return langTypeSingleton
2928
*/
30-
private LangType langTypeSingleton;
29+
private MethodType.LangType langTypeSingleton;
3130

3231
/**
3332
* Sets the LangType variable for this instance.
3433
* @param langType The language type to set. Must not be null.
3534
* @return The LangType that was set.
3635
*/
37-
public LangType setLangTypeVariable(LangType langType) {
36+
public MethodType.LangType setLangTypeVariable(MethodType.LangType langType) {
3837
if (langType == null) {
3938
throw new IllegalArgumentException("LangType cannot be null");
4039
}

0 commit comments

Comments
 (0)