feat: finalize translations for toasts

This commit is contained in:
Erica Marigold 2023-12-07 23:24:02 +05:30
parent 920efccfcb
commit 4f06d2dec7
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1
4 changed files with 18 additions and 13 deletions

View file

@ -20,7 +20,8 @@ public class TouchGrassWarningClient implements ClientModInitializer {
@Override
public void onInitializeClient(ModContainer mod) {
LOGGER.info("Touch Grass Warning init; isEnabled={}, reminderFrequency={}h", config.isEnabled, config.reminderFrequency);
LOGGER.info("Touch Grass Warning init; isEnabled={}, reminderFrequency={}h", config.isEnabled,
config.reminderFrequency);
LOGGER.info("Registering JOIN & DISCONNECT events...");
if (config.isEnabled) {

View file

@ -12,5 +12,5 @@ public class ConfigModel {
@SerialEntry(comment = "Number of hours the warning should be displayed after")
@AutoGen(category = "touch_grass_warning")
@IntField(min = 1)
public int reminderFrequency = 24;
public int reminderFrequency = 24;
}

View file

@ -15,9 +15,11 @@ public class PlayDurationHandler implements Runnable {
public PlayDurationHandler(Minecraft client, long startTime, int reminderFrequency) {
this.client = client;
this.startTime = startTime;
this.reminderFrequency = reminderFrequency;
this.toast = new SystemToast(SystemToastIds.TUTORIAL_HINT, Component.literal(String.format("You've been playing for greater than %d hours", reminderFrequency)),
Component.literal("Excessive gaming may interfere with normal daily life"));
this.toast = new SystemToast(SystemToastIds.TUTORIAL_HINT,
Component.translatable("touch_grass_warning.toast.name", reminderFrequency),
Component.translatable("touch_grass_warning.toast.description"));
}
@Override
@ -34,7 +36,7 @@ public void run() {
}
try {
// Check every 10 minutes
// Recheck every 10 minutes
Thread.sleep(10 * 60 * 1000);
} catch (InterruptedException e) {
e.printStackTrace();

View file

@ -1,9 +1,11 @@
{
"yacl3.config.touchgrassreminder:config.category.touch_grass_warning": "Touch Grass Reminder",
"yacl3.config.touchgrassreminder:config.isEnabled": "Enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.1": "Whether most of the mod's functionality is enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.2": "Takes effect on restart",
"yacl3.config.touchgrassreminder:config.reminderFrequency": "Reminder frequency",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.1": "After how long the warning should appear (in hours)",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.2": "Takes effect on restart"
}
"yacl3.config.touchgrassreminder:config.category.touch_grass_warning": "Touch Grass Reminder",
"yacl3.config.touchgrassreminder:config.isEnabled": "Enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.1": "Whether most of the mod's functionality is enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.2": "Takes effect on restart",
"yacl3.config.touchgrassreminder:config.reminderFrequency": "Reminder frequency",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.1": "After how long the warning should appear (in hours)",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.2": "Takes effect on restart",
"touch_grass_warning.toast.title": "You've been playing for greater than %d hours",
"touch_grass_warning.toast.description": "Excessive gaming may interfere with normal daily life"
}