chore: clean up a bit

This commit is contained in:
Johannes Frohnmeyer 2024-05-10 14:28:10 +02:00
parent fa4fa75944
commit 6ede586866
Signed by: Johannes
GPG Key ID: E76429612C2929F4
3 changed files with 5 additions and 14 deletions

View File

@ -19,13 +19,6 @@ public class Translater {
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
private static final TransformingMap map = new TransformingMap(new CachingTransformer(new TranslatingTransformer<>(TranslateService.getConfigured())));
public static boolean progressUIEnabled() {
return Cfg.renderProgress == ProgressMode.Full || Cfg.renderProgress == ProgressMode.Gui;
}
public static boolean progressLogsEnabled() {
return Cfg.renderProgress == ProgressMode.Full || Cfg.renderProgress == ProgressMode.Console;
}
public static @NotNull TransformingMap getMap(@Nullable Map<String, String> base) {
if (base != null) map.updateBacker(base);
return map;

View File

@ -1,9 +1,8 @@
package io.gitlab.jfronny.translater.transformer;
import io.gitlab.jfronny.translater.Cfg;
import io.gitlab.jfronny.translater.RenderScheduler;
import io.gitlab.jfronny.translater.Translater;
import io.gitlab.jfronny.translater.mixin.MinecraftClientAccessor;
import net.minecraft.client.MinecraftClient;
import java.util.Collection;
import java.util.Map;

View File

@ -69,10 +69,8 @@ public class TranslatingTransformer<T extends Language> implements Transformer {
} else {
return translateMultiple(str);
}
}
catch (Exception e) {
Translater.LOGGER.warn("Failed to transform: \"{}\" ({} characters)", str, str.length());
Translater.LOGGER.warn("Please report this bug with the mod containing the lang file");
} catch (Exception e) {
Translater.LOGGER.warn("Failed to transform: \"{}\" ({} characters)! Please report this bug with the mod containing the lang file! ({})", str, str.length(), e.getLocalizedMessage());
return null;
}
}
@ -109,7 +107,8 @@ public class TranslatingTransformer<T extends Language> implements Transformer {
if (Cfg.detailedProgress) Translater.LOGGER.info("Transformed: \"{}\" to: \"{}\"", str, currentState);
return currentState;
} catch (Exception e) {
Translater.LOGGER.warn("Failed to break: \"{}\" ({} characters). Is your API key valid?", m.group(2), m.group(2).length());
String s = m.group(2);
Translater.LOGGER.warn("Failed to break: \"{}\" ({} characters). Is your API key valid? ({})", s, s.length(), e.getLocalizedMessage());
throw e;
}
}