feat: Add translation script and instructions

This will allow people who want to contribute new languages to easily duplicate the files to be translated, with the abbreviation of the associated language.

Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This commit is contained in:
nothingbutlucas 2024-04-22 00:32:50 -03:00
parent 8a08eff0fa
commit 1c4ab6a2ef
No known key found for this signature in database
GPG Key ID: 31DE05DB3B0D9074
2 changed files with 41 additions and 0 deletions

View File

@ -1,2 +1,10 @@
# Reticulum Website # Reticulum Website
This is the sources for the Reticulum website currently reachable at [https://reticulum.network/](https://reticulum.network/). This is the sources for the Reticulum website currently reachable at [https://reticulum.network/](https://reticulum.network/).
### Add new translation
Execute the `add_new_translation.sh` script and follow the instructions
```bash
bash add_new_translation.sh
```

33
add_new_translation.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
set -e
origin_directory="./source/"
destiny_directory="./source/"
echo -e "\n"
# Ask the user for the new translation language
read -r -p "Enter the new translation language [es, en, fr, etc]: " new_language
if [[ -z "$new_language" ]]; then
echo -e "Invalid language code"
exit 1
fi
echo "Duplicating files for $new_language language"
for file in "$origin_directory"/*; do
# Took the original files and duplicate them with the new language
if [[ ! "$file" =~ _ ]]; then
# Parse name and extesion
name=$(basename "$file")
name_without_extension="${name%.*}"
extension="${name##*.}"
new_name="${name_without_extension}_${new_language}.${extension}"
# Duplicate the file
cp "$file" "$destiny_directory/$new_name"
fi
done
echo -e "Done, happy translation!"