diff --git a/src/main/java/com/izanagicraft/messages/StaticMessagePlaceholders.java b/src/main/java/com/izanagicraft/messages/placeholders/StaticMessagePlaceholders.java
similarity index 97%
rename from src/main/java/com/izanagicraft/messages/StaticMessagePlaceholders.java
rename to src/main/java/com/izanagicraft/messages/placeholders/StaticMessagePlaceholders.java
index 20d2d30..f35b22a 100644
--- a/src/main/java/com/izanagicraft/messages/StaticMessagePlaceholders.java
+++ b/src/main/java/com/izanagicraft/messages/placeholders/StaticMessagePlaceholders.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.izanagicraft.messages;
+package com.izanagicraft.messages.placeholders;
import java.util.ArrayList;
import java.util.HashMap;
@@ -28,7 +28,7 @@
import java.util.regex.Pattern;
/**
- * message-format; com.izanagicraft.messages:StatticMessagePlaceholders
+ * message-format; com.izanagicraft.messages.placeholders:StaticMessagePlaceholders
*
* Utility class for handling placeholders in messages.
*
diff --git a/src/main/java/com/izanagicraft/messages/WrappedString.java b/src/main/java/com/izanagicraft/messages/strings/WrappedString.java
similarity index 95%
rename from src/main/java/com/izanagicraft/messages/WrappedString.java
rename to src/main/java/com/izanagicraft/messages/strings/WrappedString.java
index e3dc6d7..53f66d0 100644
--- a/src/main/java/com/izanagicraft/messages/WrappedString.java
+++ b/src/main/java/com/izanagicraft/messages/strings/WrappedString.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package com.izanagicraft.messages;
+package com.izanagicraft.messages.strings;
/**
- * message-format; com.izanagicraft.messages:WrappedString
+ * message-format; com.izanagicraft.messages.strings:WrappedString
*
* The WrappedString class represents a simple wrapper around a String value.
* It provides methods to create, access, and modify the underlying String.
diff --git a/src/main/java/com/izanagicraft/messages/Translations.java b/src/main/java/com/izanagicraft/messages/translations/GlobalTranslations.java
similarity index 97%
rename from src/main/java/com/izanagicraft/messages/Translations.java
rename to src/main/java/com/izanagicraft/messages/translations/GlobalTranslations.java
index e06bb2b..005af0c 100644
--- a/src/main/java/com/izanagicraft/messages/Translations.java
+++ b/src/main/java/com/izanagicraft/messages/translations/GlobalTranslations.java
@@ -17,7 +17,10 @@
* along with this program. If not, see .
*/
-package com.izanagicraft.messages;
+package com.izanagicraft.messages.translations;
+
+import com.izanagicraft.messages.strings.WrappedString;
+import com.izanagicraft.messages.placeholders.StaticMessagePlaceholders;
import java.io.File;
import java.io.FileInputStream;
@@ -28,14 +31,14 @@
import java.util.concurrent.ConcurrentHashMap;
/**
- * message-format; com.izanagicraft.messages:Translations
+ * message-format; com.izanagicraft.messages.translations:GlobalTranslations
*
* Utility class for handling translations with placeholders.
*
* @author @sanguine6660
* @since 13.12.2023
*/
-public final class Translations {
+public final class GlobalTranslations {
/**
* A map that stores translations for different locales.
@@ -48,7 +51,7 @@ public final class Translations {
private static Properties fallback;
// instantiation prevention
- private Translations() {
+ private GlobalTranslations() {
}
/**
diff --git a/src/test/java/tests/TranslationsTest.java b/src/test/java/tests/GlobalTranslationsTest.java
similarity index 77%
rename from src/test/java/tests/TranslationsTest.java
rename to src/test/java/tests/GlobalTranslationsTest.java
index 7c2fbbf..d81a362 100644
--- a/src/test/java/tests/TranslationsTest.java
+++ b/src/test/java/tests/GlobalTranslationsTest.java
@@ -20,7 +20,7 @@
package tests;
-import com.izanagicraft.messages.Translations;
+import com.izanagicraft.messages.translations.GlobalTranslations;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -32,15 +32,15 @@
import static org.junit.jupiter.api.Assertions.*;
/**
- * message-format; tests:TranslationTest
+ * message-format; tests:GlobalTranslationsTest
*
* @author LuciferMorningstarDev
* @since 13.12.2023
*/
-public class TranslationsTest {
+public class GlobalTranslationsTest {
@BeforeAll
- static void initTranslations() {
+ static void initGlobalTranslations() {
// Load the test language file
File testFile = new File("src/test/resources/lang.properties");
@@ -49,7 +49,7 @@ static void initTranslations() {
// Initialize translations with the test language file
Map defaultReplacements = createDefaultReplacements();
- Translations.init(defaultReplacements, testFile);
+ GlobalTranslations.init(defaultReplacements, testFile);
}
private static Map createDefaultReplacements() {
@@ -62,24 +62,24 @@ private static Map createDefaultReplacements() {
@Test
void testInit() {
// Ensure translations are initialized
- assertNotNull(Translations.getTranslations());
- assertFalse(Translations.getTranslations().isEmpty());
+ assertNotNull(GlobalTranslations.getTranslations());
+ assertFalse(GlobalTranslations.getTranslations().isEmpty());
// Ensure fallback is set
- assertNotNull(Translations.getFallback());
+ assertNotNull(GlobalTranslations.getFallback());
}
@Test
void testTranslateGreeting() {
// Test translating the 'greeting' key with a placeholder
- String translated = Translations.translate("greeting", "John");
+ String translated = GlobalTranslations.translate("greeting", "John");
assertEquals("[PREFIX] Hello, John!", translated);
}
@Test
void testTranslateGreetingWithLocale() {
// Test translating the 'greeting' key with a specific locale
- String translated = Translations.translate(Locale.US, "greeting", "Alice");
+ String translated = GlobalTranslations.translate(Locale.US, "greeting", "Alice");
assertEquals("[PREFIX] Hello, Alice!", translated);
}
@@ -88,7 +88,7 @@ void testTranslateIterator() {
// Test translating the 'iterator' key with a numeric placeholder
for (int i = 0; i < 5; i++) {
int placeholderValue = 42;
- String translated = Translations.translate("iterator", placeholderValue);
+ String translated = GlobalTranslations.translate("iterator", placeholderValue);
String expected = "[PREFIX] Current Iteration Index " + placeholderValue + ".";
assertEquals(expected, translated);
}
@@ -100,7 +100,7 @@ void testTranslateIteratorWithLocale() {
// Test translating the 'iterator' key with a specific locale and numeric placeholder
for (int i = 0; i < 5; i++) {
int placeholderValue = i;
- String translated = Translations.translate(locale, "iterator", placeholderValue);
+ String translated = GlobalTranslations.translate(locale, "iterator", placeholderValue);
String expected = "[PREFIX] Current Iteration Index " + placeholderValue + ".";
assertEquals(expected, translated);
}
@@ -109,21 +109,21 @@ void testTranslateIteratorWithLocale() {
@Test
void testTranslateWithMissingKey() {
// Test translating a key that does not exist in the language file
- String translated = Translations.translate("nonexistent.key", "arg1", "arg2");
+ String translated = GlobalTranslations.translate("nonexistent.key", "arg1", "arg2");
assertEquals("nonexistent.key", translated);
}
@Test
void testTranslateWithDefaultReplacements() {
// Test translating with default replacements
- String translated = Translations.translate("greeting");
+ String translated = GlobalTranslations.translate("greeting");
assertEquals("[PREFIX] Hello, null!", translated);
}
@Test
void testTranslateWithInvalidLocale() {
// Test translating with an invalid locale, should fall back to default
- String translated = Translations.translate(new Locale("invalid"), "greeting", "Bob");
+ String translated = GlobalTranslations.translate(new Locale("invalid"), "greeting", "Bob");
assertEquals("[PREFIX] Hello, Bob!", translated);
}
diff --git a/src/test/java/tests/StaticMessagePlaceholdersTest.java b/src/test/java/tests/StaticMessagePlaceholdersTest.java
index f56d7da..9de67cf 100644
--- a/src/test/java/tests/StaticMessagePlaceholdersTest.java
+++ b/src/test/java/tests/StaticMessagePlaceholdersTest.java
@@ -19,7 +19,7 @@
package tests;
-import com.izanagicraft.messages.StaticMessagePlaceholders;
+import com.izanagicraft.messages.placeholders.StaticMessagePlaceholders;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;