Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 13:30:17 +01:00
Checkstyle strikes again!
Dieser Commit ist enthalten in:
Ursprung
7c0b622742
Commit
1bd691f91b
@ -249,36 +249,35 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
|||||||
.create(Key.key("velocity", "translations"));
|
.create(Key.key("velocity", "translations"));
|
||||||
translationRegistry.defaultLocale(Locale.US);
|
translationRegistry.defaultLocale(Locale.US);
|
||||||
try {
|
try {
|
||||||
FileSystemUtils.visitResources(VelocityServer.class,
|
FileSystemUtils.visitResources(VelocityServer.class, path -> {
|
||||||
"com/velocitypowered/proxy/l10n", path -> {
|
logger.info("Loading localizations...");
|
||||||
logger.info("Loading localizations...");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.walk(path).forEach(file -> {
|
Files.walk(path).forEach(file -> {
|
||||||
if (!Files.isRegularFile(file)) {
|
if (!Files.isRegularFile(file)) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
String filename = com.google.common.io.Files
|
|
||||||
.getNameWithoutExtension(file.getFileName().toString());
|
|
||||||
String localeName = filename.replace("messages_", "")
|
|
||||||
.replace("messages", "")
|
|
||||||
.replace('_', '-');
|
|
||||||
Locale locale;
|
|
||||||
if (localeName.isEmpty()) {
|
|
||||||
locale = Locale.US;
|
|
||||||
} else {
|
|
||||||
locale = Locale.forLanguageTag(localeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
translationRegistry.registerAll(locale,
|
|
||||||
ResourceBundle.getBundle("com/velocitypowered/proxy/l10n/messages",
|
|
||||||
locale, UTF8ResourceBundleControl.get()), false);
|
|
||||||
});
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.error("Encountered an I/O error whilst loading translations", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String filename = com.google.common.io.Files
|
||||||
|
.getNameWithoutExtension(file.getFileName().toString());
|
||||||
|
String localeName = filename.replace("messages_", "")
|
||||||
|
.replace("messages", "")
|
||||||
|
.replace('_', '-');
|
||||||
|
Locale locale;
|
||||||
|
if (localeName.isEmpty()) {
|
||||||
|
locale = Locale.US;
|
||||||
|
} else {
|
||||||
|
locale = Locale.forLanguageTag(localeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
translationRegistry.registerAll(locale,
|
||||||
|
ResourceBundle.getBundle("com/velocitypowered/proxy/l10n/messages",
|
||||||
|
locale, UTF8ResourceBundleControl.get()), false);
|
||||||
});
|
});
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Encountered an I/O error whilst loading translations", e);
|
||||||
|
}
|
||||||
|
}, "com", "velocitypowered", "proxy", "l10n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Encountered an I/O error whilst loading translations", e);
|
logger.error("Encountered an I/O error whilst loading translations", e);
|
||||||
return;
|
return;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren