mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Former-commit-id: 76aef3e704f171e23d6f0a6f78b051717e0f3212 Former-commit-id: 03373859fb5d858afbf4e92528dceb2dc118c763
36 lines
1.0 KiB
Java
36 lines
1.0 KiB
Java
package com.Torvald.Terrarum.LangPack;
|
|
|
|
import com.Torvald.Terrarum.Terrarum;
|
|
|
|
import java.io.*;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.Properties;
|
|
|
|
/**
|
|
* Created by minjaesong on 16-01-22.
|
|
*/
|
|
public class Lang {
|
|
|
|
private static Properties lang;
|
|
private static Properties langFallback;
|
|
private static final String FALLBACK_LANG_CODE = "en";
|
|
|
|
public Lang() throws IOException {
|
|
lang = new Properties();
|
|
lang.load(new BufferedReader(new InputStreamReader(new FileInputStream(
|
|
"res/locales/" + Terrarum.gameLocale + ".lang"), StandardCharsets.UTF_8)));
|
|
|
|
langFallback = new Properties();
|
|
langFallback.load(new BufferedReader(new InputStreamReader(new FileInputStream(
|
|
"res/locales/" + FALLBACK_LANG_CODE + ".lang"), StandardCharsets.UTF_8)));
|
|
}
|
|
|
|
public static String get(String key) {
|
|
return lang.getProperty(key
|
|
,langFallback.getProperty(key
|
|
, key)
|
|
);
|
|
}
|
|
|
|
}
|