mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
switch to OtterLib language registry
This commit is contained in:
parent
91faaba5c8
commit
9ac4cd5156
3 changed files with 5 additions and 14 deletions
|
@ -60,23 +60,11 @@ public class FileData {
|
||||||
return playerSettings.getOrDefault(player, sittingConfig);
|
return playerSettings.getOrDefault(player, sittingConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the language / text system for the mod
|
|
||||||
private static final LanguageReader langReader = new LanguageReader(
|
|
||||||
new ResourceReader("assets/sit-oth3r/lang/",Sit.class.getClassLoader()),
|
|
||||||
new ResourceReader(Data.CONFIG_DIR),"en_us","en_us");
|
|
||||||
|
|
||||||
public static LanguageReader getLangReader() {
|
|
||||||
return langReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loads all config files to memory
|
* loads all config files to memory
|
||||||
*/
|
*/
|
||||||
public static void loadFiles() {
|
public static void loadFiles() {
|
||||||
getServerConfig().load();
|
getServerConfig().load();
|
||||||
// load the language reader
|
|
||||||
langReader.updateLanguage(getServerConfig().getLang());
|
|
||||||
|
|
||||||
getSittingConfig().load();
|
getSittingConfig().load();
|
||||||
// if loading file and is on supported server on client, send the new settings over
|
// if loading file and is on supported server on client, send the new settings over
|
||||||
if (Data.isClient() && Data.isSupportedServer()) {
|
if (Data.isClient() && Data.isSupportedServer()) {
|
||||||
|
|
|
@ -283,6 +283,9 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
version = 2.3;
|
version = 2.3;
|
||||||
this.lang = this.lang.substring(0,3)+this.lang.substring(3).toLowerCase();
|
this.lang = this.lang.substring(0,3)+this.lang.substring(3).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the language reader
|
||||||
|
LanguageReg.getLang(Data.MOD_ID).updateLanguage(lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package one.oth3r.sit.utl;
|
package one.oth3r.sit.utl;
|
||||||
|
|
||||||
import one.oth3r.otterlib.chat.CTxT;
|
import one.oth3r.otterlib.chat.CTxT;
|
||||||
import one.oth3r.sit.file.FileData;
|
import one.oth3r.otterlib.registry.LanguageReg;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
@ -11,6 +11,6 @@ public class Chat {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CTxT lang(String key, Object... args) {
|
public static CTxT lang(String key, Object... args) {
|
||||||
return FileData.getLangReader().dynamicTranslatable(key, args);
|
return LanguageReg.getLang(Data.MOD_ID).dynamicTranslatable(key, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue