- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
public void load()
{
for(Language lang : Language.VALUES)
{
strings.put(lang, new HashMap<String, String>());
File f = new File(Config.DATAPACK_ROOT, "data/string/strings_" + lang.getShortName() + ".properties");
if(!f.exists())
{
log.warn("Not find file: {}", f.getAbsolutePath());
continue;
}
LineNumberReader reader = null;
try
{
reader = new LineNumberReader(new FileReader(f));
String line = null;
while((line = reader.readLine()) != null)
{
if(line.startsWith("#"))
continue;
StringTokenizer token = new StringTokenizer(line, "=");
if(token.countTokens() < 2)
{
log.error("Error on line: " + line + "; file: " + f.getName());
continue;
}
String name = token.nextToken();
String value = token.nextToken();
while(token.hasMoreTokens())
value += "=" + token.nextToken();
Map<String, String> strings = this.strings.get(lang);
strings.put(name, value);
}
}
catch(Exception e)
{
log.error("Exception: " + e, e);
}
finally
{
try
{
reader.close();
}
catch(Exception e)
{
log.error("Cannot close reader", e);
}
}
}
log();
}