mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Add script for updating translations
This commit is contained in:
parent
2ea1766677
commit
a0fca6d96c
31
src/lang/extra/_checkMissingTranslations.sh
Executable file
31
src/lang/extra/_checkMissingTranslations.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Please specify a language file to update"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
language_file="$1"
|
||||||
|
|
||||||
|
# Check that the specified file exists
|
||||||
|
if [ ! -f "$language_file" ]; then
|
||||||
|
echo "File not found: $language_file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read each line from the English file and check if it exists in the language file
|
||||||
|
while read -r line; do
|
||||||
|
# Skip lines that start with #
|
||||||
|
if [[ $line =~ ^#.* ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Extract the string code from the English line
|
||||||
|
STRING_CODE=$(echo $line | cut -d' ' -f1)
|
||||||
|
# Check if the string code exists in the language file
|
||||||
|
if ! grep -qw "$STRING_CODE" "$language_file"; then
|
||||||
|
# If the line doesn't exist, add it to the end of the language file
|
||||||
|
continue
|
||||||
|
echo "$line" >>"$language_file"
|
||||||
|
echo "Added missing line to $language_file: $line"
|
||||||
|
fi
|
||||||
|
done <"english.txt"
|
Loading…
Reference in New Issue
Block a user