chore: clean up logging
This commit is contained in:
parent
dc2a35dcc9
commit
42e6b1a03f
@ -72,7 +72,7 @@ public class GoogleChat implements ModInitializer {
|
|||||||
translated.append(translateIfNeeded(sibling, direction, false));
|
translated.append(translateIfNeeded(sibling, direction, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GoogleChatConfig.Advanced.debugLogs) LOGGER.info("Translated " + sourceString + " to " + toString(translated));
|
if (GoogleChatConfig.Advanced.debugLogs) LOGGER.info("Translated {0} to {1}", sourceString, toString(translated));
|
||||||
if (GoogleChatConfig.General.translationTooltip) {
|
if (GoogleChatConfig.General.translationTooltip) {
|
||||||
return t.copy().styled(style -> addHover(style, Text.literal("Translated: ").append(translated)));
|
return t.copy().styled(style -> addHover(style, Text.literal("Translated: ").append(translated)));
|
||||||
} else if (translated.getStyle().getHoverEvent() == null) {
|
} else if (translated.getStyle().getHoverEvent() == null) {
|
||||||
@ -113,7 +113,7 @@ public class GoogleChat implements ModInitializer {
|
|||||||
} else if (t instanceof PlainTextContent.Literal tx) {
|
} else if (t instanceof PlainTextContent.Literal tx) {
|
||||||
return new PlainTextContent.Literal(translateIfNeeded(tx.string(), direction, false));
|
return new PlainTextContent.Literal(translateIfNeeded(tx.string(), direction, false));
|
||||||
} else {
|
} else {
|
||||||
// LOGGER.info("Unhandled text type: " + source.getClass() + " (" + source + ")");
|
// LOGGER.info("Unhandled text type: {0} ({1}})", source.getClass().toString(), source.toString());
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -149,7 +149,7 @@ public class GoogleChat implements ModInitializer {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return m.group(1) + svc.translate(m.group(2), sourceLang, targetLang) + m.group(3);
|
return m.group(1) + svc.translate(m.group(2), sourceLang, targetLang) + m.group(3);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOGGER.error("Could not translate text: " + source, e);
|
LOGGER.error("Could not translate text: {0}", e, source);
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -5,8 +5,6 @@ import net.minecraft.text.Text;
|
|||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static io.gitlab.jfronny.libjf.LibJf.LOGGER;
|
|
||||||
|
|
||||||
public sealed interface TranslatableContainer<T, S extends TranslatableContainer<T, S>> {
|
public sealed interface TranslatableContainer<T, S extends TranslatableContainer<T, S>> {
|
||||||
S translate(TranslationDirection direction);
|
S translate(TranslationDirection direction);
|
||||||
|
|
||||||
@ -26,7 +24,7 @@ public sealed interface TranslatableContainer<T, S extends TranslatableContainer
|
|||||||
|
|
||||||
static Text translateAndLog(final Text source, final TranslationDirection direction) {
|
static Text translateAndLog(final Text source, final TranslationDirection direction) {
|
||||||
var translated = GoogleChat.translateIfNeeded(source, direction, true);
|
var translated = GoogleChat.translateIfNeeded(source, direction, true);
|
||||||
if (GoogleChatConfig.Advanced.debugLogs) LOGGER.info("Applied C2S translation from {0} to {1}", source, translated);
|
if (GoogleChatConfig.Advanced.debugLogs) GoogleChat.LOGGER.info("Applied C2S translation from {0} to {1}", source, translated);
|
||||||
return translated;
|
return translated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user