This commit is contained in:
fullwall 2012-10-04 18:28:23 +08:00
parent 80aeaf5770
commit 1a3ebd0990
3 changed files with 13 additions and 0 deletions

View File

@ -152,6 +152,7 @@ public class Messages {
public static final String VULNERABLE_STOPPED = "citizens.commands.npc.vulnerable.stopped"; public static final String VULNERABLE_STOPPED = "citizens.commands.npc.vulnerable.stopped";
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider"; public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default"; public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
public static final String MISSING_TRANSLATIONS = "citizens.notifications.missing-translations";
private static Properties getDefaultBundleProperties() { private static Properties getDefaultBundleProperties() {
Properties defaults = new Properties(); Properties defaults = new Properties();

View File

@ -28,6 +28,7 @@ public class Translator {
Translator.class.getClassLoader(), resourceFile)); Translator.class.getClassLoader(), resourceFile));
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
preferredBundle = getDefaultBundle(); preferredBundle = getDefaultBundle();
Messaging.logTr(Messages.MISSING_TRANSLATIONS, locale);
} }
} }
@ -89,6 +90,11 @@ public class Translator {
return file.toURI().toURL(); return file.toURI().toURL();
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
} }
} else {
string = string.replaceFirst("/", "");
URL test = Translator.class.getResource('/' + string);
if (test != null)
return test;
} }
return super.getResource(string); return super.getResource(string);
} }
@ -101,6 +107,11 @@ public class Translator {
return new FileInputStream(file); return new FileInputStream(file);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
} }
} else {
string = string.replaceFirst("/", "");
InputStream stream = Translator.class.getResourceAsStream('/' + string);
if (stream != null)
return stream;
} }
return super.getResourceAsStream(string); return super.getResourceAsStream(string);
} }

View File

@ -7,6 +7,7 @@ citizens.commands.invalid-number=That is not a valid number.
citizens.commands.npc.age.cannot-be-aged=The mob type '{0}' cannot be aged. citizens.commands.npc.age.cannot-be-aged=The mob type '{0}' cannot be aged.
citizens.commands.npc.age.invalid-age=Invalid age. Valid ages are adult, baby, number between -24000 and 0 citizens.commands.npc.age.invalid-age=Invalid age. Valid ages are adult, baby, number between -24000 and 0
citizens.commands.npc.age.set=[[{0}]] is now [[{1}]]. citizens.commands.npc.age.set=[[{0}]] is now [[{1}]].
citizens.notifications.missing-translations=Missing translations file for locale {0}. Defaulting to en locale.
citizens.commands.npc.behaviour.added=Behaviours added. citizens.commands.npc.behaviour.added=Behaviours added.
citizens.commands.npc.behaviour.removed=Behaviours removed. citizens.commands.npc.behaviour.removed=Behaviours removed.
citizens.commands.npc.controllable.not-controllable=[[{0}]] is not controllable. citizens.commands.npc.controllable.not-controllable=[[{0}]] is not controllable.