[Show And Tell] Language Translations WIP #251
Replies: 1 comment
-
Update from May 2, 2025: Initial work on the language engine has begun.
Initially, AI assisted in the creation of an extraction script written in PowerShell that extracted the Next came the task of grouping everything inside each of the case blocks into their files. For this, AI assisted in the creation of another script that created grouped versions of those extracted files, each containing the counterparts for each language. Now, you may notice that every line is duplicated. I don't exactly know what happened there, but I was able to fix it (relatively) quickly. To do this, enter Bash and its (amazing...) text manipulation utilities. #!/bin/bash
for languageblock in `ls ./*.language-blocks.*.txt`; do
linecount=$( wc -l "$languageblock" | cut -f1 -d" " )
firstline="$(cat "$languageblock" | head -n 1)"
secondline="$(cat "$languageblock" | head -n 2 | tail -n 1)"
if [ "$firstline" == "$secondline" ]; then
cat "$languageblock" | head -n $(($linecount-1)) | uniq > "$languageblock.unique.txt"
else
cp "$languageblock" "$languageblock.unique.txt"
echo -e "" >> "$languageblock.unique.txt"
fi
done In short, this script grabs the contents of each language block and gets rid of duplicate lines using All of this works and gives us unique lines for those that presented duplicate ones, and leaves files intact otherwise: The time it took me to complete this script was mind-boggling. I get why Bash has a fitting name for something I don't want to do, bash my screen. Anyways, no displays were hurt, and I could move on by replacing the original files with the unique ones. I used PowerShell for this one, and it was much easier for me: Finally, it was time to combine them all into one. For this, I found Bash to be the easiest: #!/bin/bash
langcode="$1"
if [ "$langcode" != "" ]; then
touch "./language_$langcode.ini"
cat *.language-blocks.$langcode.txt >> "./language_$langcode.ini"
fi It combined all of them into a single INI file for each language. Yes, it's quite messy now but, in my opinion, it may be easier to work with. That's the end of this update. Note that no updates will be done to DT until the language files are ready. |
Beta Was this translation helpful? Give feedback.
-
This discussion page will talk about all the changes made for the new language engine in version 0.7. Lots of things have been done right now to extract the contents from the source files and prepare them in an INI format.
Stay tuned for updates!
Beta Was this translation helpful? Give feedback.
All reactions