1.18.2 support explicitly using the Google Translate service
This commit is contained in:
parent
8cc66d4081
commit
e3d422f983
|
@ -2,10 +2,16 @@ apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle"
|
|||
|
||||
dependencies {
|
||||
include modImplementation("io.gitlab.jfronny.libjf:libjf-config-v0:${project.jfapi_version}")
|
||||
include modImplementation("io.gitlab.jfronny.libjf:libjf-translate-v0:${project.jfapi_version}")
|
||||
include modImplementation("io.gitlab.jfronny.libjf:libjf-translate-v1:${project.jfapi_version}")
|
||||
include("io.gitlab.jfronny.libjf:libjf-unsafe-v0:${project.jfapi_version}")
|
||||
include("io.gitlab.jfronny.libjf:libjf-base:${project.jfapi_version}")
|
||||
modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-devutil-v0:${project.jfapi_version}")
|
||||
|
||||
modImplementation "com.terraformersmc:modmenu:3.0.1"
|
||||
|
||||
// Compat fix
|
||||
modRuntimeOnly(fabricApi.module("fabric-api-base", "${project.fabric_version}"))
|
||||
modRuntimeOnly(fabricApi.module("fabric-resource-loader-v0", "${project.fabric_version}"))
|
||||
modRuntimeOnly(fabricApi.module("fabric-screen-api-v1", "${project.fabric_version}"))
|
||||
modRuntimeOnly(fabricApi.module("fabric-command-api-v1", "${project.fabric_version}"))
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop/
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=build.22
|
||||
loader_version=0.12.12
|
||||
# Mod Properties
|
||||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=build.1
|
||||
loader_version=0.13.3
|
||||
maven_group=io.gitlab.jfronny
|
||||
archives_base_name=translater
|
||||
# Dependencies
|
||||
jfapi_version=2.4.0
|
||||
|
||||
jfapi_version=2.5.0
|
||||
fabric_version=0.47.8+1.18.2
|
||||
|
||||
modrinth_id=YnU8kpyc
|
||||
modrinth_optional_dependencies=eueI9czw
|
||||
curseforge_id=394823
|
||||
curseforge_optional_dependencies=modmenu
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.translater;
|
|||
|
||||
import io.gitlab.jfronny.libjf.config.api.Entry;
|
||||
import io.gitlab.jfronny.libjf.config.api.JfConfig;
|
||||
import io.gitlab.jfronny.libjf.translate.Language;
|
||||
import io.gitlab.jfronny.libjf.translate.impl.google.Language;
|
||||
|
||||
public class Cfg implements JfConfig {
|
||||
@Entry
|
||||
|
|
|
@ -5,17 +5,17 @@ import io.gitlab.jfronny.translater.transformer.TransformingMap;
|
|||
import io.gitlab.jfronny.translater.transformer.TranslatingTransformer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class Translater {
|
||||
public static final String MOD_ID = "translater";
|
||||
public static final Logger LOGGER = LogManager.getFormatterLogger(MOD_ID);
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
private static final TransformingMap map = new TransformingMap(new CachingTransformer(new TranslatingTransformer()));
|
||||
|
||||
public static boolean progressUIEnabled() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.gitlab.jfronny.translater.transformer;
|
||||
|
||||
import io.gitlab.jfronny.libjf.translate.Language;
|
||||
import io.gitlab.jfronny.libjf.translate.TranslateException;
|
||||
import io.gitlab.jfronny.libjf.translate.TranslateService;
|
||||
import io.gitlab.jfronny.libjf.translate.api.TranslateException;
|
||||
import io.gitlab.jfronny.libjf.translate.impl.google.GoogleTranslateService;
|
||||
import io.gitlab.jfronny.libjf.translate.impl.google.Language;
|
||||
import io.gitlab.jfronny.translater.Cfg;
|
||||
import io.gitlab.jfronny.translater.Translater;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -15,6 +15,7 @@ public class TranslatingTransformer implements Transformer {
|
|||
private static final Pattern SURROUNDING_SPACE_PATTERN = Pattern.compile("^(\\s*)(.*[^\\s]+)(\\s*)$");
|
||||
private final Random rnd;
|
||||
private final Language[] languages = Language.values();
|
||||
private final GoogleTranslateService ts = new GoogleTranslateService();
|
||||
@Override
|
||||
public String transform(String str) {
|
||||
try {
|
||||
|
@ -78,10 +79,10 @@ public class TranslatingTransformer implements Transformer {
|
|||
Language currentLang = startLang;
|
||||
for (int i = 0; i < Cfg.rounds; i++) { // Translate around
|
||||
Language newLang = randomLanguage();
|
||||
currentState = TranslateService.translate(currentState, Cfg.breakFully ? randomLanguage() : currentLang, newLang);
|
||||
currentState = ts.translate(currentState, Cfg.breakFully ? randomLanguage() : currentLang, newLang);
|
||||
currentLang = newLang;
|
||||
}
|
||||
currentState = TranslateService.translate(currentState, currentLang, startLang == Language.AUTO_DETECT ? Language.ENGLISH : startLang); // Translate to starting language
|
||||
currentState = ts.translate(currentState, currentLang, startLang == Language.AUTO_DETECT ? Language.ENGLISH : startLang); // Translate to starting language
|
||||
currentState = m.group(1) + currentState + m.group(3); // Add back surrounding white space
|
||||
Translater.LOGGER.info("Transformed: \"" + str + "\" to: \"" + currentState + "\"");
|
||||
return currentState;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#---Lang---
|
||||
#Sun Dec 19 18:09:34 CET 2021
|
||||
#Mon Feb 28 20:58:46 CET 2022
|
||||
=
|
||||
Get\ a\ Recycler=Get a Recycler
|
||||
\u00A79Sword\ \u00A77-\ \u00A7rAOE\ Damage\ multiplier=\u00A79sword\u00A77- \u00A7rdamage ratio to AOE
|
||||
|
@ -9959,6 +9959,7 @@ Blue\ Enchanted\ Leaves=Blue Enchanted Leaves
|
|||
+1\ luck\ at\ night.=+1 night tour.
|
||||
Golden\ Excavator=Golden Excavator
|
||||
Better\ End\:\ Items=Best Ending\: Articles
|
||||
There\ is\ no\ structure\ with\ type\ "%s"=There is no such structure.%s""
|
||||
Splash\ Potion\ of\ Glowing=overflow
|
||||
Lapis-Decorated\ Red\ Sandstone=red lapis lazuli sandstone decoration
|
||||
New\ Chapters=New Chapters
|
||||
|
@ -10541,6 +10542,7 @@ Auto\ Push=Automatic thrust
|
|||
Blue\ Shingles\ Slab=Blue Shingles Slab
|
||||
you\ a\ looting\ effect,\ but=Or you change the power
|
||||
Rose\ Gold\ Excavator=Rose Gold Excavator
|
||||
Could\ not\ find\ a\ structure\ of\ type\ "%s"\ nearby=Type not found '%s"near
|
||||
Axle=middle
|
||||
Load\ Flowers=Load Flowers
|
||||
Advanced\ Tank\ Unit=Advanced Tank Unit
|
||||
|
@ -11784,6 +11786,7 @@ Cherry\ Oak\ Stairs=Cherry Oak Stairs
|
|||
The\ dismount\ key\ binding.=Remove the button closure.
|
||||
Blacklisted\ Dimensions=Blacklisted measures
|
||||
Mossy\ Cobblestone\ Platform=Mossy Cobblestone Platform
|
||||
Failed\ to\ place\ feature=The development of the operation failed
|
||||
Cika\ Post=Post cika.
|
||||
Cyan\ Pickaxe=Pickaxe Sian
|
||||
Mojang\ (or\ legacy)=Mojang (or obsolete)
|
||||
|
@ -12535,6 +12538,7 @@ F3\ +\ H\ \=\ Advanced\ tooltips=F3 + h \= (powee of sugestii
|
|||
Cleared=Cleared
|
||||
Ender\ Bramble=Thorn bushes
|
||||
Stripped\ Maple\ Log=Stripped Maple Log
|
||||
You've\ been\ playing\ for\ %s\ hour(s)=you play inside %s time)
|
||||
Not\ heated\ up=Not heated up
|
||||
Soul\ Embers=Live coal
|
||||
Uvarovite\ Dust=Uvarovite Dust
|
||||
|
@ -15800,6 +15804,7 @@ Rose\ Gold\ Plates=Rose Gold Plates
|
|||
Conduit\ activates=The channel is activated
|
||||
Baobab\ Boat=Baobab Boat
|
||||
Impaling=Impale
|
||||
32-bit\ system\ detected=32 bit system detected
|
||||
Leather\ Strap=Leather Strap
|
||||
Mandrake=Mandrake
|
||||
Medium\ to\ Low\ energy\ tier=Medium to Low energy tier
|
||||
|
@ -16273,6 +16278,7 @@ Cobbled\ Deepslate\ Wall=Inner stone wall
|
|||
Small\ Pile\ of\ Sphalerite\ Dust=Small Pile of Sphalerite Dust
|
||||
Phantom\ Membrane\ Wing=Phantom Membrane Wing
|
||||
Start\ of\ Multiblock\ Madness=The start of the multiblock madness
|
||||
There\ is\ no\ feature\ with\ type\ "%s"=any "typical" characteristic%s"
|
||||
Unknown\ enchantment\:\ %s=Unknown, Of Admiration, Of %s
|
||||
Beryllium\ Oxide\ Tiny\ Dust=Beryllium Oxide
|
||||
Secondary\ Modifier\ Key=Secondary Modifier Key
|
||||
|
@ -17025,6 +17031,7 @@ Peridot\ Helmet=Peridot Helmet
|
|||
Disable\ protection\ for\ the\ following\ category?=Deactivate protection for next class?
|
||||
Light\ Blue\ Concrete\ Bricks=Black concrete stones
|
||||
Crude\ Oil\ Bucket=Crude oil tank
|
||||
Invalid\ maxHeight\ %s;\ expected\ higher\ than\ world\ minimum\ %s=MaxHeight is not valid %s; expected to be higher than the lowest rate in the world %s
|
||||
Black\ Puff=Black Puff
|
||||
Spawn\ Crawler\ Egg=The caterpillars form eggs.
|
||||
Allow\ absolute\ coordinates=Full coordinates are allowed
|
||||
|
@ -17579,6 +17586,7 @@ Antimony\ Nugget=Antimony block
|
|||
Blocks\ Mirrored=Mirror block
|
||||
Light\ Gray\ Botania=light botanical gray
|
||||
Treasure\ Fished=The Treasure Chest Was Removed
|
||||
You've\ been\ playing\ for\ greater\ than\ 24\ hours=You've been playing for more than 24 hours
|
||||
Show\ Server\ Ticks\ ms=Show Server Ticks ms
|
||||
LudoCrypt\ -\ Luminous\ Plantation=LudoCrypt - Planta\u00E7\u00E3o Luminosa
|
||||
Netherite\ Crossbow=Netherlight elbow
|
||||
|
@ -18392,6 +18400,7 @@ Soot\ Plate=Soot Plate
|
|||
Polymer\ Clay=Polymer clay
|
||||
Criterion=default
|
||||
Powder\ Snow=Snow dust
|
||||
Placed\ "%s"\ at\ %s,\ %s,\ %s=has been sent"%sExists %s, %s, %s
|
||||
Cursed\ Lasso=Cursed Lasso
|
||||
\nAdd\ Oak\ Mansions\ to\ modded\ forest\ category\ biomes\ that\ are\ not\ birch\ or\ dark\ forest.\ 1\ for\ spawning\ in\ most\ chunks\ and\ 1001\ for\ none.=Oak Mansion has been added to biomass other than birch or dark forest biomass. One for breeding in most places, 1001 without.
|
||||
Light\ Blue\ Bed=The Blue Light On The Bottom
|
||||
|
@ -20879,6 +20888,7 @@ Yellow\ Shulker\ Block=Yellow Schalke block
|
|||
Enderman\ Spawn\ Egg=Enderman Spawn Egg
|
||||
Search\ at\:\ Anywhere\ in\ name.=Location\: Anywhere in the name.
|
||||
Exchanging\ Gadget=Replace devices
|
||||
32-bit\ system\ detected\:\ this\ may\ prevent\ you\ from\ playing\ in\ the\ future\ as\ a\ 64-bit\ system\ will\ be\ required\!=32-bit system detected\: This may prevent you from playing in the future as a 64-bit system is required\!
|
||||
Are\ you\ sure\ you\ would\ like\ to\ delete\ the\ current\ set=Are you sure you want to delete the current episode?
|
||||
Drop\ death\ chests=Throw away the coffin
|
||||
Blue\ Glazed\ Terracotta\ Glass=Blue Glazed Terracotta Glass
|
||||
|
@ -28254,6 +28264,7 @@ Windows\ /\ Menu=Windows / Menu
|
|||
Oak\ Crate=Oak Crate
|
||||
Tall\ Lime\ Lily=Tall Lime Lily
|
||||
No\ Tool\ Required=No tools required
|
||||
Minecraft\ will\ soon\ require\ a\ 64-bit\ system,\ which\ will\ prevent\ you\ from\ playing\ or\ using\ Realms\ on\ this\ device.\ You\ will\ need\ to\ manually\ cancel\ any\ Realms\ subscription.=You will not be able to play or use Realms on this device because Minecraft requires a 64-bit system. You must cancel all Realms subscriptions manually.
|
||||
Vampire\ dies=vampire
|
||||
Alloy\ Furnace=Alloy Furnace
|
||||
The\ sky\ is\ too\ bright=The sky is very clear
|
||||
|
@ -28580,6 +28591,7 @@ Botania\ Advancements=advances in botany
|
|||
A\ myth?\ Or\ reality?=History? Or something?
|
||||
Sythian\ Chair=Setian armchair
|
||||
Ender\ Ore=Ends ore
|
||||
Excessive\ gaming\ may\ interfere\ with\ normal\ daily\ life=Too many games can interfere with your daily life.
|
||||
%s\ (%s)=%s (%s)
|
||||
Wither\ Skeleton=Wither Skeleton
|
||||
Candied\ Nuts=candy beans
|
||||
|
|
Loading…
Reference in New Issue