Skip to content

Commit

Permalink
Added translated message server side, with many languages
Browse files Browse the repository at this point in the history
  • Loading branch information
muriplz committed Jan 19, 2024
1 parent 575b4e6 commit 3af2fec
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 13 deletions.
14 changes: 5 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ base {
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = 'Translations API'
url = 'https://maven.nucleoid.xyz'
}
}

loom {
Expand All @@ -38,11 +37,8 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modImplementation include("xyz.nucleoid:server-translations-api:${servertranslations_version}")
}

processResources {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ fabric_version=0.91.0+1.20.1
# Mod Properties
mod_version=1.1
maven_group=com.kryeit
archives_base_name=votifier
archives_base_name=votifier

servertranslations_version=2.0.0+1.20
5 changes: 3 additions & 2 deletions src/main/java/com/kryeit/votifier/command/Vote.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.text.ClickEvent;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import xyz.nucleoid.server.translations.api.Localization;

import java.util.function.Supplier;

Expand All @@ -25,8 +26,8 @@ public static int execute(CommandContext<ServerCommandSource> context) {
return 0;
}

String link = LINK;
player.sendMessage(Text.literal("Voting site -> " + link)
String link = LINK.replace("%player%", player.getName().getString());
player.sendMessage(Text.literal(Localization.raw("votifier.voting_site", player) + " -> " + link)
.setStyle(Style.EMPTY.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link))));
return Command.SINGLE_SUCCESS;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/de_de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Abstimmungsseite"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Voting Site"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/es_es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Página de votación"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/fr_fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Site de vote"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/hi_in.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "मतदान साइट"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/it_it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Sito di Votazione"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/ja_jp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "投票サイト"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/ko_kr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "투표 사이트"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/lv_lv.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Balsošanas vietne"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/nb_no.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Avstemningsnettsted"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/nl_nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Stemsite"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/pt_br.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Site de Votação"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/pt_pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Site de Votação"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/ru_ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Сайт Голосования"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/sv_se.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Röstningssida"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/tr_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "Oylama Sitesi"
}
3 changes: 3 additions & 0 deletions src/main/resources/data/votifier/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"votifier.voting_site": "投票网站"
}
2 changes: 1 addition & 1 deletion src/main/resources/votifier.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"port": "8192",
"debug": false,
"command-after-voting": "/give %player% diamond 1",
"voting-link": "https://minecraft.net/?vote=true"
"voting-link": "https://minecraft.net/?vote=true?user=%player%"
}

0 comments on commit 3af2fec

Please sign in to comment.