@@ -60,11 +60,12 @@ public static String tlUI(TranslationComponent translationComponent) {
60
60
// }
61
61
62
62
public static String tl (String locale , Lang key , Object ... params ) {
63
+ locale = locale .toLowerCase (Locale .ROOT ).replace ("-" , "_" );
63
64
return tl (locale , new TranslationComponent (key .getKey (), (Object []) convert (locale , params )));
64
65
}
65
66
66
67
public static String tl (String locale , TranslationComponent translationComponent ) {
67
- locale = locale .toLowerCase (Locale .ROOT );
68
+ locale = locale .toLowerCase (Locale .ROOT ). replace ( "-" , "_" ) ;
68
69
YamlConfiguration yamlConfiguration = INSTANCE_HOLDER .languageFilesManager .getDistribution (locale );
69
70
if (yamlConfiguration == null ) {
70
71
yamlConfiguration = INSTANCE_HOLDER .languageFilesManager .getDistribution ("en_us" );
@@ -146,12 +147,14 @@ public void load() {
146
147
Collection <String > pending = getOverrideLocales (languageFilesManager .getDistributions ().keySet ());
147
148
log .debug ("Pending: {}" , Arrays .toString (pending .toArray ()));
148
149
pending .forEach (locale -> {
150
+ locale = locale .toLowerCase (Locale .ROOT ).replace ("-" , "_" );
149
151
File file = getOverrideLocaleFile (locale );
150
152
if (file .exists ()) {
151
153
YamlConfiguration configuration = new YamlConfiguration ();
152
154
try {
153
155
configuration .loadFromString (Files .readString (file .toPath (), StandardCharsets .UTF_8 ));
154
156
languageFilesManager .deploy (locale , configuration );
157
+ System .out .println ("deployed " + locale );
155
158
} catch (InvalidConfigurationException | IOException e ) {
156
159
log .warn ("Failed to override translation for {}." , locale , e );
157
160
}
@@ -283,6 +286,7 @@ protected Collection<String> getOverrideLocales(@NotNull Collection<String> pool
283
286
284
287
@ NotNull
285
288
private File getOverrideLocaleFile (@ NotNull String locale ) {
289
+ locale = locale .toLowerCase (Locale .ROOT ).replace ("-" , "_" );
286
290
File file ;
287
291
// bug fixes workaround
288
292
file = new File (overrideDirectory , locale + ".yml" );
0 commit comments