File tree 1 file changed +2
-4
lines changed
cloudnet-rest-module/src/main/java/eu/cloudnetservice/ext/modules/rest
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -71,16 +71,14 @@ public final class CloudNetRestModule extends DriverModule {
71
71
public static void loadTranslations (@ NonNull I18n i18n ) {
72
72
var resourcePath = Path .of (ResourceResolver .resolveCodeSourceOfClass (CloudNetRestModule .class ));
73
73
FileUtil .openZipFile (resourcePath , fs -> {
74
- // get the language directory
75
74
var langDir = fs .getPath ("lang/" );
76
75
if (Files .notExists (langDir ) || !Files .isDirectory (langDir )) {
77
76
throw new IllegalStateException ("lang/ must be an existing directory inside the jar to load" );
78
77
}
79
- // visit each file and register it as a language source
78
+
80
79
FileUtil .walkFileTree (langDir , ($ , sub ) -> {
81
- // try to load and register the language file
82
80
try (var stream = Files .newInputStream (sub )) {
83
- var lang = sub .getFileName ().toString ().replace (".properties" , "" );
81
+ var lang = sub .getFileName ().toString ().replace ('_' , '-' ). replace ( ".properties" , "" );
84
82
i18n .registerProvider (Locale .forLanguageTag (lang ), PropertiesTranslationProvider .fromProperties (stream ));
85
83
} catch (IOException exception ) {
86
84
LOGGER .error ("Unable to open language file for reading @ {}" , sub , exception );
You can’t perform that action at this time.
0 commit comments