Skip to content

Commit c5b7535

Browse files
authored
Merge pull request #3 from Pyrofab/tornado-rewrite
TornadoFX rewrite + JSON support, closes #2
2 parents afa323b + 8ef4130 commit c5b7535

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1779
-1013
lines changed

.classpath

-7
This file was deleted.

.idea/artifacts/TranslationHelper.xml

-20
This file was deleted.

.project

-23
This file was deleted.

.settings/org.eclipse.jdt.core.prefs

-11
This file was deleted.

README.md

+28-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,41 @@ A tool to aid in the creation of translation files
33

44
Mod translations are annoying. You need to fiddle with text files and switch back and forth in your editors to make sure you get it right.
55
And then the mod updates, new translations are added and you are lost among invalid translations and untranslated features.
6-
If you're a modder, you may also be afraid of changing translation keys as that may break existing translations.
6+
If you are a modder, you may also be afraid of changing translation keys as that may break existing translations.
77

88
This tool simplifies your work by providing an intuitive interface to work with.
99

10+
![screenshot](https://image.prntscr.com/image/2PnZaOKYRrWxAJmT_Z0WBA.png)
11+
1012
## Usage instructions
1113
* Download MinecraftTranslationHelper on the [release page](https://github.com/Pyrofab/MinecraftTranslationHelper/releases). Preferably put it near your translations.
12-
* Run it and use the "Load a lang folder" button to navigate to the lang folder of the mod you're currently translating.
13-
* After selecting a lang folder, a popup will appear. You can just press 'OK' if you want to edit all the existing translation files or you can deselect files you do not want to see and lock files you do not want to edit.
14-
<img src="https://image.prntscr.com/image/Sle1DGqQT5KEcPPQ8KEi6A.png" alt="popup screenshot" height="225" width="125"/>
15-
* The tool wil then load all selected translations side by side with the key on the left side. You can then edit any field and the program will do the rest.
14+
15+
* Run it and use the **File | Open** menu item to navigate to the lang folder of the mod you're currently translating.
16+
17+
* After selecting a lang folder, a popup will appear. You can just press `OK` if you want to edit all the existing translation files or you can deselect files you do not want to see and lock files you do not want to edit.
18+
<img src="https://image.prntscr.com/image/brgM0B2yTbGHRqI2m2RMmw.png" alt="popup screenshot" height="225" width="125"/>
19+
20+
* The tool wil then load all selected translations side by side with the key on the left side. You can edit any field and the program will do the rest.
21+
1622
* Yes you can drag and drop columns or sort them differently.
23+
1724
* Do you want to delete or change a translation key ? Right click in the table to open the context menu.
18-
* If you run out of inspiration, you can use the 'Joker' button. This will autocomplete the cell based on Google Translate's answer. If you use this feature, please double check the result and keep the wacky translations at a minimum.
25+
1926
* When you are done, click the save button to apply the changes. This will only affect changed files.
27+
You also have the option to save automatically every few seconds in **File | Toggle autosave**
28+
29+
*Note : this program does not care about comments and fancy line separators.
30+
Upon hitting save, all irrelevant information will be erased from any edited file.*
31+
32+
### Ask Google
33+
If you run out of inspiration, you can use the 'Ask Google' menu option.
34+
This will autocomplete the cell based on Google Translate's answer.
35+
If you use this feature, please double check the result and keep the wacky translations at a minimum.
36+
37+
### Smart Replace
38+
Smart Replace is a feature that lets you translate repetitive lines in a few clicks.
39+
To open the smart replace dialog, select **Edit | Smart Replace** or press `Ctrl+R`.
2040

21-
Note : this program doesn't care about comments and fancy line separators. Upon hitting save, all irrelevant information will be erased from any edited file.
41+
![Smart replace dialog screenshot](https://image.prntscr.com/image/bohQv8RyR2mXtB385DC4qw.png)
2242

23-
![screenshot](https://image.prntscr.com/image/c4djsaUyTPGiuJvF4q9AWQ.png)
43+
This will take all lines in the English language file ending with *Item Frame* and set their French localization to *Cadre* followed by the beginning of the English line. If you want full regex patterns, surround your regular expression with `/` (e.g. the wildcard expression above is equivalent to `/(.*) Item Frame/`). If you just want to use raw strings, uncheck the *Allow wildcards / raw regex* option. The input and output languages can be the same, allowing efficient localization workflow.

build.fxbuild

-8
This file was deleted.

build.gradle.kts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
4+
plugins {
5+
java
6+
kotlin("jvm") version "1.3.11"
7+
id("com.github.johnrengelman.shadow") version "4.0.1"
8+
}
9+
10+
group = "ladysnake"
11+
version = "2.0.0"
12+
13+
repositories {
14+
mavenCentral()
15+
}
16+
17+
dependencies {
18+
compile(kotlin("stdlib-jdk8"))
19+
testCompile("junit", "junit", "4.12")
20+
compile("no.tornado:tornadofx:1.7.16")
21+
}
22+
23+
tasks.withType<ShadowJar> {
24+
manifest {
25+
attributes["Main-Class"] = "ladysnake.translationhelper.TranslationHelper"
26+
}
27+
}
28+
29+
configure<JavaPluginConvention> {
30+
sourceCompatibility = JavaVersion.VERSION_1_8
31+
}
32+
tasks.withType<KotlinCompile> {
33+
kotlinOptions.jvmTarget = "1.8"
34+
}

changelog.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# v2.0.0 - The reasonable code update
2+
3+
- Rewrote everything with TornadoFX and fewer disgusting hacks
4+
- Now supports 1.13+ json lang format !
5+
- Added the ability to export lang files to either format
6+
- Added a toggle to (un)lock files once loaded
7+
- Added an autosave option (persistent between launches)
8+
- Added the ability to specify a lang folder to open with a program arg
9+
- Added *open all/none* and *(un)lock all* checkboxes to the file selection dialogue
10+
- Added an **Insert row** option to the context menu
11+
- Added an application icon (thanks to RiverLeviathan)
12+
- Added a `*` indicator to unsaved lang files
13+
- Added a **Help | README** button linking to the repo's readme
14+
- The search replace feature now uses wildcards by default
15+
- Moved every button to a menu bar
16+
- Added a menu item for every feature
17+
18+
# v1.3.0 - The convenience update
19+
20+
- Adds regex search-replace ! Press Ctrl+R, choose your input file, your output file, a regular expression and a string to replace it with and the program will handle everything else !
21+
- Adds change history ! You can now undo your mistakes with Ctrl+Z and redo things with either Ctrl+Shift+Z or Ctrl+Y. (some operations like search-replace will need several undo to cancel completely)
22+
- Adds copy and pasting for entire cells. Select a cell and use Ctrl+C to copy its content, select one or more cell and use Ctrl+V to paste your clipboard's content into the selected cells.
23+
- Now automatically switches to edit mode as soon as you start typing in an editable cell.
24+
- You can now delete the content of a cell by using the del key.
25+
26+
# v1.2.0 - The practical update
27+
28+
- Adds a popup screen when loading a lang folder that allows you to select which lang files to load and which files to lock
29+
- Locked lang files will never be updated by the tool (until reloading)
30+
- Added utf-8 support
31+
32+
# v1.1.1
33+
34+
- Made the sorting operation mark language files as unsaved
35+
36+
# v1.1 - The Shitty Translations update
37+
38+
- Added google translate support (plz dont spam it)
39+
- Added ctrl-s shortcut
40+
- Added confirmation request when closing the program with unsaved changes
41+
42+
# v1.0 - First release
43+
- Idk, it works I guess ?

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kotlin.code.style=official

gradle/wrapper/gradle-wrapper.jar

54.9 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#!/usr/bin/env sh
2+
3+
##############################################################################
4+
##
5+
## Gradle start up script for UN*X
6+
##
7+
##############################################################################
8+
9+
# Attempt to set APP_HOME
10+
# Resolve links: $0 may be a link
11+
PRG="$0"
12+
# Need this for relative symlinks.
13+
while [ -h "$PRG" ] ; do
14+
ls=`ls -ld "$PRG"`
15+
link=`expr "$ls" : '.*-> \(.*\)$'`
16+
if expr "$link" : '/.*' > /dev/null; then
17+
PRG="$link"
18+
else
19+
PRG=`dirname "$PRG"`"/$link"
20+
fi
21+
done
22+
SAVED="`pwd`"
23+
cd "`dirname \"$PRG\"`/" >/dev/null
24+
APP_HOME="`pwd -P`"
25+
cd "$SAVED" >/dev/null
26+
27+
APP_NAME="Gradle"
28+
APP_BASE_NAME=`basename "$0"`
29+
30+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31+
DEFAULT_JVM_OPTS=""
32+
33+
# Use the maximum available, or set MAX_FD != -1 to use that value.
34+
MAX_FD="maximum"
35+
36+
warn () {
37+
echo "$*"
38+
}
39+
40+
die () {
41+
echo
42+
echo "$*"
43+
echo
44+
exit 1
45+
}
46+
47+
# OS specific support (must be 'true' or 'false').
48+
cygwin=false
49+
msys=false
50+
darwin=false
51+
nonstop=false
52+
case "`uname`" in
53+
CYGWIN* )
54+
cygwin=true
55+
;;
56+
Darwin* )
57+
darwin=true
58+
;;
59+
MINGW* )
60+
msys=true
61+
;;
62+
NONSTOP* )
63+
nonstop=true
64+
;;
65+
esac
66+
67+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68+
69+
# Determine the Java command to use to start the JVM.
70+
if [ -n "$JAVA_HOME" ] ; then
71+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72+
# IBM's JDK on AIX uses strange locations for the executables
73+
JAVACMD="$JAVA_HOME/jre/sh/java"
74+
else
75+
JAVACMD="$JAVA_HOME/bin/java"
76+
fi
77+
if [ ! -x "$JAVACMD" ] ; then
78+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79+
80+
Please set the JAVA_HOME variable in your environment to match the
81+
location of your Java installation."
82+
fi
83+
else
84+
JAVACMD="java"
85+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86+
87+
Please set the JAVA_HOME variable in your environment to match the
88+
location of your Java installation."
89+
fi
90+
91+
# Increase the maximum file descriptors if we can.
92+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93+
MAX_FD_LIMIT=`ulimit -H -n`
94+
if [ $? -eq 0 ] ; then
95+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96+
MAX_FD="$MAX_FD_LIMIT"
97+
fi
98+
ulimit -n $MAX_FD
99+
if [ $? -ne 0 ] ; then
100+
warn "Could not set maximum file descriptor limit: $MAX_FD"
101+
fi
102+
else
103+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104+
fi
105+
fi
106+
107+
# For Darwin, add options to specify how the application appears in the dock
108+
if $darwin; then
109+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110+
fi
111+
112+
# For Cygwin, switch paths to Windows format before running java
113+
if $cygwin ; then
114+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116+
JAVACMD=`cygpath --unix "$JAVACMD"`
117+
118+
# We build the pattern for arguments to be converted via cygpath
119+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120+
SEP=""
121+
for dir in $ROOTDIRSRAW ; do
122+
ROOTDIRS="$ROOTDIRS$SEP$dir"
123+
SEP="|"
124+
done
125+
OURCYGPATTERN="(^($ROOTDIRS))"
126+
# Add a user-defined pattern to the cygpath arguments
127+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129+
fi
130+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
131+
i=0
132+
for arg in "$@" ; do
133+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135+
136+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138+
else
139+
eval `echo args$i`="\"$arg\""
140+
fi
141+
i=$((i+1))
142+
done
143+
case $i in
144+
(0) set -- ;;
145+
(1) set -- "$args0" ;;
146+
(2) set -- "$args0" "$args1" ;;
147+
(3) set -- "$args0" "$args1" "$args2" ;;
148+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154+
esac
155+
fi
156+
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
161+
}
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166+
167+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169+
cd "$(dirname "$0")"
170+
fi
171+
172+
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)