diff options
author | nea <romangraef@gmail.com> | 2022-08-27 15:41:16 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-27 15:41:16 +0200 |
commit | d9353ff54c20a08e4e078e0190fc1f364b08a2d1 (patch) | |
tree | cbff878e3d4ebbf943b2ebc732a8bbbcce74ff10 /src/main/kotlin/moe/nea/notenoughupdates | |
parent | 2019473c50dfe3f1c6fd071d123d49d43bc180c4 (diff) | |
download | Firmament-d9353ff54c20a08e4e078e0190fc1f364b08a2d1.tar.gz Firmament-d9353ff54c20a08e4e078e0190fc1f364b08a2d1.tar.bz2 Firmament-d9353ff54c20a08e4e078e0190fc1f364b08a2d1.zip |
translation
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates')
5 files changed, 28 insertions, 26 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt index 1e59d78..55f2c50 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt @@ -13,7 +13,7 @@ fun neuCommand() = literal("neu") { thenLiteral("reload") { thenLiteral("fetch") { thenExecute { - source.sendFeedback(Text.literal("Trying to redownload the repository")) // TODO better reporting + source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.network")) // TODO better reporting RepoManager.launchAsyncUpdate() } } diff --git a/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt b/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt index 00bc099..23c8d18 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt @@ -1,31 +1,31 @@ package moe.nea.notenoughupdates.gui -import moe.nea.notenoughupdates.repo.RepoManager import net.minecraft.text.Text +import moe.nea.notenoughupdates.repo.RepoManager fun repoGui(): ConfigGui<RepoManager.Config> { return ConfigGui(RepoManager) { - title(Text.literal("NotEnoughUpdates Repo Settings")) - toggle(Text.literal("Auto Update"), RepoManager.Config::autoUpdate) + title(Text.translatable("notenoughupdates.gui.repo.title")) + toggle(Text.translatable("notenoughupdates.gui.repo.autoupdate"), RepoManager.Config::autoUpdate) textfield( - Text.literal("Repo Username"), - Text.literal("<github user>"), + Text.translatable("notenoughupdates.gui.repo.username"), + Text.translatable("notenoughupdates.gui.repo.hint.username"), RepoManager.Config::user, maxLength = 255 ) textfield( - Text.literal("Repo Name"), - Text.literal("<repo name>"), + Text.translatable("notenoughupdates.gui.repo.reponame"), + Text.translatable("notenoughupdates.gui.repo.hint.reponame"), RepoManager.Config::repo ) textfield( - Text.literal("Repo Branch"), - Text.literal("<repo branch>"), + Text.translatable("notenoughupdates.gui.repo.branch"), + Text.translatable("notenoughupdates.gui.repo.hint.branch"), RepoManager.Config::branch ) button( - Text.literal("Reset to Defaults"), - Text.literal("Reset"), + Text.translatable("notenoughupdates.gui.repo.reset.label"), + Text.translatable("notenoughupdates.gui.repo.reset"), ) { RepoManager.config.user = "NotEnoughUpdates" RepoManager.config.repo = "NotEnoughUpdates-REPO" diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt index 19ae606..7dbfce3 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt @@ -5,11 +5,14 @@ import io.github.cottonmc.cotton.gui.client.CottonHud import io.github.moulberry.repo.IReloadable import io.github.moulberry.repo.NEURepository import io.github.moulberry.repo.data.NEUItem +import java.io.PrintWriter +import java.nio.file.Path +import java.util.concurrent.ConcurrentHashMap import kotlinx.coroutines.Job import kotlinx.coroutines.launch -import moe.nea.notenoughupdates.NotEnoughUpdates -import moe.nea.notenoughupdates.util.LegacyTagParser -import moe.nea.notenoughupdates.util.appendLore +import kotlin.io.path.absolutePathString +import kotlin.io.path.writer +import net.minecraft.client.resource.language.I18n import net.minecraft.datafixer.Schemas import net.minecraft.datafixer.TypeReferences import net.minecraft.item.ItemStack @@ -18,11 +21,9 @@ import net.minecraft.nbt.NbtCompound import net.minecraft.nbt.NbtOps import net.minecraft.text.Text import net.minecraft.util.Identifier -import java.io.PrintWriter -import java.nio.file.Path -import java.util.concurrent.ConcurrentHashMap -import kotlin.io.path.absolutePathString -import kotlin.io.path.writer +import moe.nea.notenoughupdates.NotEnoughUpdates +import moe.nea.notenoughupdates.util.LegacyTagParser +import moe.nea.notenoughupdates.util.appendLore object ItemCache : IReloadable { val dfuLog = Path.of("logs/dfulog.txt") @@ -60,7 +61,7 @@ object ItemCache : IReloadable { val modernItemTag = oldItemTag.transformFrom10809ToModern() ?: return ItemStack(Items.PAINTING).apply { setCustomName(Text.literal(this@asItemStackNow.displayName)) - appendLore(listOf(Text.literal("Exception rendering item: $skyblockItemId"))) + appendLore(listOf(Text.translatable("notenoughupdates.repo.brokenitem", skyblockItemId))) } val itemInstance = ItemStack.fromNbt(modernItemTag) if (itemInstance.nbt?.contains("Enchantments") == true) { @@ -98,12 +99,13 @@ object ItemCache : IReloadable { CottonHud.remove(RepoManager.progressBar) return@launch } - RepoManager.progressBar.reportProgress("Recache Items", 0, items.size) + val recacheItems = I18n.translate("notenoughupdates.repo.cache") + RepoManager.progressBar.reportProgress(recacheItems, 0, items.size) CottonHud.add(RepoManager.progressBar) var i = 0 items.values.forEach { it.asItemStack() // Rebuild cache - RepoManager.progressBar.reportProgress("Recache Items", i++, items.size) + RepoManager.progressBar.reportProgress(recacheItems, i++, items.size) } CottonHud.remove(RepoManager.progressBar) } diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt index 34279af..c354392 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt @@ -69,7 +69,7 @@ object RepoDownloadManager { * Downloads the latest repository from github, setting [latestSavedVersionHash]. * @return true, if an update was performed, false, otherwise (no update needed, or wasn't able to complete update) */ - suspend fun downloadUpdate(): Boolean = withContext(CoroutineName("Repo Update Check")) { + suspend fun downloadUpdate(force: Boolean): Boolean = withContext(CoroutineName("Repo Update Check")) { val latestSha = requestLatestGithubSha() if (latestSha == null) { logger.warn("Could not request github API to retrieve latest REPO sha.") diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt index ac595ca..72603d9 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt @@ -55,11 +55,11 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co }) } - fun launchAsyncUpdate() { + fun launchAsyncUpdate(force: Boolean = false) { NotEnoughUpdates.coroutineScope.launch { progressBar.reportProgress("Downloading", 0, null) CottonHud.add(progressBar) - RepoDownloadManager.downloadUpdate() + RepoDownloadManager.downloadUpdate(force) progressBar.reportProgress("Download complete", 1, 1) reload() } |