Skip to content

Commit 0a35255

Browse files
committed
Translate to english
1 parent a6c1aac commit 0a35255

File tree

13 files changed

+874
-338
lines changed

13 files changed

+874
-338
lines changed

bungee/src/main/kotlin/net/azisaba/spicyAzisaBan/bungee/listener/LockdownListener.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.azisaba.spicyAzisaBan.bungee.listener
22

3+
import net.azisaba.spicyAzisaBan.SABMessages
34
import net.md_5.bungee.api.chat.TextComponent
45
import net.md_5.bungee.api.event.PreLoginEvent
56
import net.md_5.bungee.api.plugin.Listener
@@ -9,6 +10,11 @@ object LockdownListener : Listener {
910
@EventHandler
1011
fun onLogin(e: PreLoginEvent) {
1112
e.isCancelled = true
12-
e.setCancelReason(*TextComponent.fromLegacyText("現在サーバーには参加できません。サーバー管理者へお問い合わせください。 &8(SAB: Initialization error)"))
13+
try {
14+
e.setCancelReason(*TextComponent.fromLegacyText("${SABMessages.General.failsafeKickMessage} (SAB: Initialization error)"))
15+
} catch (ex: Exception) {
16+
ex.printStackTrace()
17+
e.setCancelReason(*TextComponent.fromLegacyText("You cannot join the server right now. Please contact the server administrator. (SAB: Initialization error)"))
18+
}
1319
}
1420
}

common/src/main/kotlin/net/azisaba/spicyAzisaBan/SABMessages.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ object SABMessages {
9898
val previousPage get() = obj.getMessage("previousPage", defObj.getMessage("previousPage"))
9999
val nextPage get() = obj.getMessage("nextPage", defObj.getMessage("nextPage"))
100100
val datetime get() = obj.getMessage("datetime", defObj.getMessage("datetime"))
101+
val failsafeKickMessage get() = obj.getMessage("failsafeKickMessage", defObj.getMessage("failsafeKickMessage"))
101102

102103
object Time {
103104
private val defObj get() = General.defObj.getObj("time")
@@ -107,6 +108,34 @@ object SABMessages {
107108
val minute get() = obj.getMessage("minute", defObj.getMessage("minute"))
108109
val second get() = obj.getMessage("second", defObj.getMessage("second"))
109110
}
111+
112+
object Webhook {
113+
private val defObj get() = General.defObj.getObj("webhook")
114+
private val obj get() = General.obj.getObj("webhook")
115+
val type get() = obj.getMessage("type", defObj.getMessage("type"))
116+
val operator get() = obj.getMessage("operator", defObj.getMessage("operator"))
117+
val punishOperator get() = obj.getMessage("punishOperator", defObj.getMessage("punishOperator"))
118+
val target get() = obj.getMessage("target", defObj.getMessage("target"))
119+
val server get() = obj.getMessage("server", defObj.getMessage("server"))
120+
val newReason get() = obj.getMessage("newReason", defObj.getMessage("newReason"))
121+
val oldReason get() = obj.getMessage("oldReason", defObj.getMessage("oldReason"))
122+
val unpunishReason get() = obj.getMessage("unpunishReason", defObj.getMessage("unpunishReason"))
123+
val punishReason get() = obj.getMessage("punishReason", defObj.getMessage("punishReason"))
124+
val punishmentDateTime get() = obj.getMessage("punishmentDateTime", defObj.getMessage("punishmentDateTime"))
125+
val punishmentId get() = obj.getMessage("punishmentId", defObj.getMessage("punishmentId"))
126+
val unpunishId get() = obj.getMessage("unpunishId", defObj.getMessage("unpunishId"))
127+
val proofId get() = obj.getMessage("proofId", defObj.getMessage("proofId"))
128+
val proofText get() = obj.getMessage("proofText", defObj.getMessage("proofText"))
129+
val duration get() = obj.getMessage("duration", defObj.getMessage("duration"))
130+
val expiration get() = obj.getMessage("expiration", defObj.getMessage("expiration"))
131+
val viewableByTarget get() = obj.getMessage("viewableByTarget", defObj.getMessage("viewableByTarget"))
132+
val punishmentAdded get() = obj.getMessage("punishmentAdded", defObj.getMessage("punishmentAdded"))
133+
val punishmentReasonChanged get() = obj.getMessage("punishmentReasonChanged", defObj.getMessage("punishmentReasonChanged"))
134+
val punishmentRemoved get() = obj.getMessage("punishmentRemoved", defObj.getMessage("punishmentRemoved"))
135+
val proofAdded get() = obj.getMessage("proofAdded", defObj.getMessage("proofAdded"))
136+
val proofUpdated get() = obj.getMessage("proofUpdated", defObj.getMessage("proofUpdated"))
137+
val proofRemoved get() = obj.getMessage("proofRemoved", defObj.getMessage("proofRemoved"))
138+
}
110139
}
111140

112141
object Commands {

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/AddProofCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ object AddProofCommand: Command() {
7474
if (e.message == "cancel") return
7575
throw e
7676
}
77-
Proof(proofId, p, text, public).sendWebhook(actor, "証拠が追加されました。", Color.GREEN)
77+
Proof(proofId, p, text, public).sendWebhook(actor, SABMessages.General.Webhook.proofAdded, Color.GREEN)
7878
actor.send(
7979
SABMessages.Commands.AddProof.done
8080
.replaceVariables(

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/DelProofCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object DelProofCommand: Command() {
4848
val list = SpicyAzisaBan.instance.connection.proofs.delete(FindOptions.Builder().addWhere("id", id).setLimit(1).build()).complete()
4949
if (list.isEmpty()) return actor.send(SABMessages.Commands.General.proofNotFound.replaceVariables().format(id).translate())
5050
val proof = Proof.fromTableData(list[0]).complete()!!
51-
proof.sendWebhook(actor, "証拠が削除されました。", Color.RED)
51+
proof.sendWebhook(actor, SABMessages.General.Webhook.proofRemoved, Color.RED)
5252
actor.send(
5353
SABMessages.Commands.DelProof.done
5454
.replaceVariables("id" to proof.id.toString(), "pid" to proof.punishment.id.toString(), "text" to proof.text)

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/NameHistoryCommand.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ object NameHistoryCommand : Command() {
4444
"${if (isLast) "<green>" else "<aqua>"}<underlined>$s<reset>"
4545
} else {
4646
if (isLast) {
47-
"<green>$s"
47+
"<green>$s</green>"
4848
} else {
49-
"<yellow>$s"
49+
"<yellow>$s</yellow>"
5050
}
5151
}
52-
}.joinToString("<gray> -> ").let { actor.send(it) }
52+
}.joinToString("<gray> -> </gray>").translate().let { actor.send(it) }
5353
}
5454
}
5555
.catch { actor.sendErrorMessage(it) }

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/SABCommand.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object SABCommand: Command() {
5454
private val groupRemoveConfirmation = mutableMapOf<UUID, String>()
5555

5656
private fun Actor.sendHelp() {
57-
send("$PREFIX<green>SpicyAzisaBan commands".translate())
57+
send("${SABMessages.General.prefix}<green>SpicyAzisaBan commands".translate())
5858
if (hasPermission("sab.command.spicyazisaban.group")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab group <group>")
5959
if (hasPermission("sab.command.spicyazisaban.info")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab info")
6060
if (hasPermission("sab.command.spicyazisaban.creategroup")) send("${ChatColor.RED}> ${ChatColor.AQUA}/sab creategroup <group>")
@@ -131,7 +131,7 @@ object SABCommand: Command() {
131131
.addValue("server", server)
132132
.build()
133133
).complete()
134-
actor.send("$PREFIX${ChatColor.GREEN}グループにサーバー($server)を追加しました。")
134+
actor.send("$PREFIX${ChatColor.GREEN}Added server ($server) to group ($groupName).")
135135
}
136136
"remove" -> {
137137
val server = args[3]
@@ -141,12 +141,12 @@ object SABCommand: Command() {
141141
.addWhere("server", server)
142142
.build()
143143
).complete()
144-
actor.send("$PREFIX${ChatColor.GREEN}グループからサーバーを(そのグループに入っている場合は)除外しました。")
144+
actor.send("$PREFIX${ChatColor.GREEN}Removed server ($server) from group ($groupName).")
145145
}
146146
"info" -> {
147147
val servers = SpicyAzisaBan.instance.connection.getServersByGroup(args[1]).complete()
148-
actor.send("$PREFIX${ChatColor.AQUA}グループ: ${ChatColor.RESET}$groupName")
149-
actor.send("$PREFIX- ${ChatColor.AQUA}サーバー:")
148+
actor.send("$PREFIX${ChatColor.AQUA}Group: ${ChatColor.RESET}$groupName")
149+
actor.send("$PREFIX- ${ChatColor.AQUA}Servers:")
150150
servers.forEach { server ->
151151
actor.send("$PREFIX - ${ChatColor.GREEN}$server")
152152
}
@@ -215,7 +215,7 @@ object SABCommand: Command() {
215215
}
216216
"link" -> {
217217
if (actor !is PlayerActor) {
218-
return actor.send("${ChatColor.RED}NO ${ChatColor.AQUA}CONSOLE ${ChatColor.GOLD}ZONE")
218+
return
219219
}
220220
if (args.size <= 1) return
221221
SpicyAzisaBan.instance.connection
@@ -278,11 +278,11 @@ object SABCommand: Command() {
278278
(SpicyAzisaBan.instance.getPlatformType() != PlatformType.CLI && groupRemoveConfirmation[actor.uniqueId] != groupName)
279279
) {
280280
println("send")
281-
actor.send("$PREFIX${ChatColor.GOLD}グループ「${ChatColor.YELLOW}$groupName${ChatColor.GOLD}」を削除しますか?関連付けられているすべての処罰が解除されます。")
281+
actor.send("$PREFIX${ChatColor.GOLD}Are you sure want to remove group ${ChatColor.YELLOW}$groupName${ChatColor.GOLD}? All punishments associated with this group will be removed and this action cannot be undone.")
282282
if (SpicyAzisaBan.instance.getPlatformType() == PlatformType.CLI) {
283-
actor.send("$PREFIX${ChatColor.GOLD}削除するには${ChatColor.YELLOW}--confirm${ChatColor.GOLD}を入れて実行してください。")
283+
actor.send("$PREFIX${ChatColor.GOLD}If you are sure, re-type the command with ${ChatColor.YELLOW}--confirm${ChatColor.GOLD}.")
284284
} else {
285-
actor.send("$PREFIX${ChatColor.GOLD}削除するには10秒以内に同じコマンドをもう一度実行してください。")
285+
actor.send("$PREFIX${ChatColor.GOLD}If you are sure, re-enter the command within 10 seconds.")
286286
}
287287
if (SpicyAzisaBan.instance.getPlatformType() != PlatformType.CLI) {
288288
groupRemoveConfirmation[actor.uniqueId] = groupName
@@ -299,7 +299,7 @@ object SABCommand: Command() {
299299
.thenDo { SpicyAzisaBan.instance.connection.serverGroup.delete(FindOptions.Builder().addWhere("group", groupName).build()).complete() }
300300
.thenDo {
301301
SpicyAzisaBan.instance.connection.cachedGroups.set(null)
302-
actor.send("$PREFIX${ChatColor.GREEN}グループに関連付けられた処罰を削除中...")
302+
actor.send("$PREFIX${ChatColor.GREEN}Removing all punishments associated with group ${ChatColor.YELLOW}$groupName${ChatColor.GREEN}...")
303303
SpicyAzisaBan.instance.connection.punishments
304304
.delete(FindOptions.Builder().addWhere("server", groupName).build())
305305
.then { it.map { td -> Punishment.fromTableData(td) } }
@@ -321,11 +321,11 @@ object SABCommand: Command() {
321321
.catch { actor.sendErrorMessage(it) }
322322
.complete()
323323
groupRemoveConfirmation.remove(actor.uniqueId)
324-
actor.send("$PREFIX${ChatColor.GREEN}グループ「${ChatColor.GOLD}$groupName${ChatColor.GREEN}」を削除しました。")
324+
actor.send("$PREFIX${ChatColor.GREEN}Group ${ChatColor.GOLD}$groupName${ChatColor.GREEN} has been removed.")
325325
}
326326
.catch {
327327
if (it::class.java == Exception::class.java) return@catch
328-
actor.send("$PREFIX${ChatColor.RED}グループの削除に失敗しました。")
328+
actor.send("$PREFIX${ChatColor.RED}Failed to delete group $groupName.")
329329
SpicyAzisaBan.LOGGER.warning("Failed to delete group $groupName")
330330
it.printStackTrace()
331331
}
@@ -339,7 +339,7 @@ object SABCommand: Command() {
339339
return SpicyAzisaBan.instance.connection.getAllGroups()
340340
.then { list ->
341341
if (list.any { it.equals(groupName, true) }) {
342-
actor.send("$PREFIX${ChatColor.RED}この名前はすでに使用されています。")
342+
actor.send("$PREFIX${ChatColor.RED}Group ${ChatColor.GOLD}$groupName${ChatColor.RED} already exists.")
343343
throw Exception()
344344
}
345345
}
@@ -351,10 +351,10 @@ object SABCommand: Command() {
351351
}
352352
}
353353
.thenDo { SpicyAzisaBan.instance.connection.cachedGroups.set(null) }
354-
.then { actor.send("${ChatColor.GREEN}グループ「${ChatColor.GOLD}$groupName${ChatColor.GREEN}」を作成しました。") }
354+
.then { actor.send("${ChatColor.GREEN}Group ${ChatColor.GOLD}$groupName${ChatColor.GREEN} has been created.") }
355355
.catch {
356356
if (it::class.java == Exception::class.java) return@catch
357-
actor.send("$PREFIX${ChatColor.RED}グループの作成に失敗しました。")
357+
actor.send("$PREFIX${ChatColor.RED}Failed to create group $groupName.")
358358
it.printStackTrace()
359359
}
360360
}

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/UpdateProofCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object UpdateProofCommand: Command() {
6767
if (public != null) builder.addValue("public", public)
6868
SpicyAzisaBan.instance.connection.proofs.update(builder.build()).complete()
6969
Proof(proof.id, proof.punishment, text ?: proof.text, public ?: proof.public)
70-
.sendWebhook(actor, "証拠が更新されました。", Color.YELLOW)
70+
.sendWebhook(actor, SABMessages.General.Webhook.proofUpdated, Color.YELLOW)
7171
actor.send(
7272
SABMessages.Commands.UpdateProof.done
7373
.replaceVariables(

common/src/main/kotlin/net/azisaba/spicyAzisaBan/commands/WarnsCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object WarnsCommand: Command() {
2121
override val permission = "sab.warns" // this should be set to true for everyone
2222

2323
override fun execute(actor: Actor, args: Array<String>) {
24-
if (actor !is PlayerActor) return actor.send("e^1")
24+
if (actor !is PlayerActor) return
2525
if (!actor.hasPermission(permission)) {
2626
return actor.send(SABMessages.General.missingPermissions.replaceVariables().translate())
2727
}

common/src/main/kotlin/net/azisaba/spicyAzisaBan/util/Util.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,12 @@ object Util {
200200

201201
fun String.translate(): net.kyori.adventure.text.Component {
202202
val legacySectionString = ChatColor.translateAlternateColorCodes('&', this)
203-
.replace(" ", "<white> </white><white> </white>")
204203
try {
205204
// try to parse as mini message
206-
return MiniMessage.miniMessage().deserialize(legacySectionString)
205+
return MiniMessage.miniMessage().deserialize(legacySectionString.replace(" ", "<white> </white><white> </white>"))
207206
} catch (_: Exception) {
208207
// fallback to legacy component
209-
val component = LegacyComponentSerializer.legacySection().deserialize(legacySectionString)
208+
val component = LegacyComponentSerializer.legacySection().deserialize(legacySectionString.replace(" ", "§f §f "))
210209
val miniMessageString = MiniMessage.miniMessage().serialize(component)
211210
return MiniMessage.miniMessage().deserialize(miniMessageString)
212211
}

0 commit comments

Comments
 (0)