File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
cloudnet-rest-module/src/main/java/eu/cloudnetservice/ext/modules/rest Expand file tree Collapse file tree 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 {
7171 public static void loadTranslations (@ NonNull I18n i18n ) {
7272 var resourcePath = Path .of (ResourceResolver .resolveCodeSourceOfClass (CloudNetRestModule .class ));
7373 FileUtil .openZipFile (resourcePath , fs -> {
74- // get the language directory
7574 var langDir = fs .getPath ("lang/" );
7675 if (Files .notExists (langDir ) || !Files .isDirectory (langDir )) {
7776 throw new IllegalStateException ("lang/ must be an existing directory inside the jar to load" );
7877 }
79- // visit each file and register it as a language source
78+
8079 FileUtil .walkFileTree (langDir , ($ , sub ) -> {
81- // try to load and register the language file
8280 try (var stream = Files .newInputStream (sub )) {
83- var lang = sub .getFileName ().toString ().replace (".properties" , "" );
81+ var lang = sub .getFileName ().toString ().replace ('_' , '-' ). replace ( ".properties" , "" );
8482 i18n .registerProvider (Locale .forLanguageTag (lang ), PropertiesTranslationProvider .fromProperties (stream ));
8583 } catch (IOException exception ) {
8684 LOGGER .error ("Unable to open language file for reading @ {}" , sub , exception );
You can’t perform that action at this time.
0 commit comments