diff --git a/freecad/gears/translations/Gear.ts b/freecad/gears/translations/Gear.ts
new file mode 100644
index 0000000..2f27a36
--- /dev/null
+++ b/freecad/gears/translations/Gear.ts
@@ -0,0 +1,712 @@
+
+
+
+
+ App::Property
+
+
+
+ freecad.gears-version
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ number of teeth
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ height
+
+
+
+
+ pitch_angle
+
+
+
+
+ pressure_angle
+
+
+
+
+
+
+
+
+
+ module
+
+
+
+
+
+
+
+ clearance
+
+
+
+
+
+
+
+
+ number of points for spline
+
+
+
+
+ if value is true the gears outer face will match the z=0 plane
+
+
+
+
+
+
+
+
+ The arc length on the pitch circle by which the tooth thicknes is reduced.
+
+
+
+
+
+
+
+ test
+
+
+
+
+ angle used for spiral bevel-gears
+
+
+
+
+
+
+
+ The pitch diameter.
+
+
+
+
+
+
+
+ The angle by which this gear can turn without moving the mating gear.
+
+
+
+
+ master gear
+
+
+
+
+ slave gear
+
+
+
+
+
+ angle at which second gear is placed
+
+
+
+
+ number of teeth of other gear
+
+
+
+
+
+
+
+ thickness
+
+
+
+
+
+
+
+
+ pressure angle
+
+
+
+
+
+ number of profiles used for loft
+
+
+
+
+ if true no boolean operation is done
+
+
+
+
+ the python object
+
+
+
+
+
+
+
+
+ double helix
+
+
+
+
+
+
+
+
+
+ beta
+
+
+
+
+
+
+
+
+
+ a fillet for the tooth-head, radius = head_fillet x module
+
+
+
+
+
+
+
+
+
+ a fillet for the tooth-root, radius = root_fillet x module
+
+
+
+
+
+
+ head_value * module_value = additional length of head
+
+
+
+
+
+ inner_diameter divided by module (hypocycloid)
+
+
+
+
+
+ outer_diameter divided by module (epicycloid)
+
+
+
+
+
+ if enabled the rack is drawn with a constant number of teeth to avoid topologic renaming.
+
+
+
+
+
+ pitch in the transverse plane
+
+
+
+
+
+ if enabled the total length of the rack is teeth x pitch, otherwise the rack starts with a tooth-flank
+
+
+
+
+
+
+
+ head * module = additional length of head
+
+
+
+
+
+
+ clearance * module = additional length of root
+
+
+
+
+ Pin ball circle radius (overrides Tooth Pitch)
+
+
+
+
+ Roller Diameter
+
+
+
+
+ Eccentricity
+
+
+
+
+ Pressure angle limit
+
+
+
+
+ Offset in pressure angle
+
+
+
+
+ Number of teeth in Cam
+
+
+
+
+ Number of points used for spline interpolation
+
+
+
+
+ Center hole's radius
+
+
+
+
+ Create pins in place
+
+
+
+
+ Center pin Z axis to generated disks
+
+
+
+
+ Show main cam disk
+
+
+
+
+ Show another reversed cam disk on top
+
+
+
+
+
+ simple
+
+
+
+
+
+ normal module if properties_from_tool=True, else it's the transverse module.
+
+
+
+
+ inside diameter
+
+
+
+
+
+ root diameter
+
+
+
+
+
+ transverse_pitch
+
+
+
+
+ Outside diameter
+
+
+
+
+
+ backlash direction
+
+
+
+
+
+ shift
+
+
+
+
+
+
+ if beta is given and properties_from_tool is enabled, gear parameters are internally recomputed for the rotated gear
+
+
+
+
+ python gear object
+
+
+
+
+ undercut
+
+
+
+
+ outside diameter
+
+
+
+
+ traverse module of the generated gear
+
+
+
+
+ the bolt radius of the rack/chain
+
+
+
+
+ type of timing-gear
+
+
+
+
+
+ pitch of gear
+
+
+
+
+ radial height of teeth
+
+
+
+
+ radial difference between pitch diameter and head of gear
+
+
+
+
+ radius of first arc
+
+
+
+
+ radius of second arc
+
+
+
+
+ radius of third arc
+
+
+
+
+ x-offset of second arc-midpoint
+
+
+
+
+ radial height of tooth
+
+
+
+
+ radial distance from tooth-head to pitch circle
+
+
+
+
+ angle of tooth flanks
+
+
+
+
+ extrusion height
+
+
+
+
+ diameter
+
+
+
+
+ reverse rotation of helix
+
+
+
+
+ FCGear_BevelGear
+
+
+ Bevel Gear
+
+
+
+
+ Create a Bevel gear
+
+
+
+
+ FCGear_CrownGear
+
+
+ Crown Gear
+
+
+
+
+ Create a Crown gear
+
+
+
+
+ FCGear_CycloidGear
+
+
+ Cycloid Gear
+
+
+
+
+ Create a Cycloid gear
+
+
+
+
+ FCGear_CycloidRack
+
+
+ Cycloid Rack
+
+
+
+
+ Create an Cycloid rack
+
+
+
+
+ FCGear_GearConnector
+
+
+
+ Combine two gears
+
+
+
+
+ FCGear_HypoCycloidGear
+
+
+ HypoCycloid Gear
+
+
+
+
+ Create a HypoCycloid gear with its pins
+
+
+
+
+ FCGear_InternalInvoluteGear
+
+
+ Internal Involute Gear
+
+
+
+
+ Create an internal involute gear
+
+
+
+
+ FCGear_InvoluteGear
+
+
+ Involute Gear
+
+
+
+
+ Create an external involute gear
+
+
+
+
+ FCGear_InvoluteRack
+
+
+ Involute Rack
+
+
+
+
+ Create an Involute rack
+
+
+
+
+ FCGear_LanternGear
+
+
+ Lantern Gear
+
+
+
+
+ Create a Lantern gear
+
+
+
+
+ FCGear_TimingGear
+
+
+ Timing Gear
+
+
+
+
+ Create a Timing gear
+
+
+
+
+ FCGear_TimingGearT
+
+
+ Timing Gear T-shape
+
+
+
+
+ Create a Timing gear T-shape
+
+
+
+
+ FCGear_WormGear
+
+
+ Worm Gear
+
+
+
+
+ Create a Worm gear
+
+
+
+
+ Log
+
+
+ Please select two gear objects.
+
+
+
+
+ Selected object is not a gear.
+
+
+
+
+ Gear module: Crown gear created, preview_mode = true for improved performance. Set preview_mode property to false when ready to cut teeth.
+
+
+
+
+ Generating cam disk
+
+
+
+
+
+ Generating secondary cam disk
+
+
+
+
+
+ Generating pins
+
+
+
+
+
+ Checking FreeCAD version
+
+
+
+
+
+ FreeCAD version (currently {}.{}.{} ({})) must be at least {}.{}.{} ({}) in order to work with Python 3.11 and above
+
+
+
+
+
+ Migrating 'teeth' property to 'num_teeth' on {} part
+
+
+
+
+
+ Workbench
+
+
+
+
+ Gear
+
+
+
+
+ Gear Workbench
+
+
+
+
diff --git a/freecad/gears/translations/README.md b/freecad/gears/translations/README.md
new file mode 100644
index 0000000..144b5d2
--- /dev/null
+++ b/freecad/gears/translations/README.md
@@ -0,0 +1,116 @@
+# About translating Gear Workbench
+
+
+- [About translating Gear Workbench](#about-translating-gear-workbench)
+ - [Updating translations template file](#updating-translations-template-file)
+ - [Creating file for missing locale](#creating-file-for-missing-locale)
+ - [Using script](#using-script)
+ - [Renaming file](#renaming-file)
+ - [Translating](#translating)
+ - [Compiling translations](#compiling-translations)
+ - [Sending translations](#sending-translations)
+ - [More information](#more-information)
+
+
+> [!NOTE]
+> All commands **must** be run in `./freecad/gears/translations/` directory.
+
+> [!IMPORTANT]
+> If you want to update/release the files you need to have installed
+> `lupdate` and `lrelease` from Qt6 version. Using the versions from
+> Qt5 is not advised because they're buggy.
+
+## Updating translations template file
+
+To update the template file from source files you should use this command:
+
+```shell
+./update_translation.sh -U
+```
+
+Once done you can commit the changes and upload the new file to CrowdIn platform
+at webpage and find the **Gear** project.
+
+## Creating file for missing locale
+
+### Using script
+
+To create a file for a new language with all **Gear** translatable strings execute
+the script with `-u` flag plus your locale:
+
+```shell
+./update_translation.sh -u de
+```
+
+### Renaming file
+
+Also you can rename new `Gear.ts` file by appending the locale code,
+for example, `Gear_de.ts` for German and change
+
+```xml
+
+```
+
+to
+
+```xml
+
+```
+
+As of 13/09/2024 the supported locales on FreeCAD
+(according to `FreeCADGui.supportedLocales()`) are 43:
+
+```python
+{'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu',
+'Belarusian': 'be', 'Bulgarian': 'bg', 'Catalan': 'ca',
+'Chinese Simplified': 'zh-CN', 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr',
+'Czech': 'cs', 'Dutch': 'nl', 'Filipino': 'fil', 'Finnish': 'fi', 'French': 'fr',
+'Galician': 'gl', 'Georgian': 'ka', 'German': 'de', 'Greek': 'el', 'Hungarian': 'hu',
+'Indonesian': 'id', 'Italian': 'it', 'Japanese': 'ja', 'Kabyle': 'kab',
+'Korean': 'ko', 'Lithuanian': 'lt', 'Norwegian': 'no', 'Polish': 'pl',
+'Portuguese': 'pt-PT', 'Portuguese, Brazilian': 'pt-BR', 'Romanian': 'ro',
+'Russian': 'ru', 'Serbian': 'sr', 'Serbian, Latin': 'sr-CS', 'Slovak': 'sk',
+'Slovenian': 'sl', 'Spanish': 'es-ES', 'Spanish, Argentina': 'es-AR',
+'Swedish': 'sv-SE', 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES',
+'Vietnamese': 'vi'}
+```
+
+## Translating
+
+To edit your language file open your file in `Qt Linguist` from `qt5-tools`/`qt6-tools`
+package or in a text editor like `xed`, `mousepad`, `gedit`, `nano`, `vim`/`nvim`,
+`geany` etc. and translate it.
+
+Alternatively you can visit the **FreeCAD-addons** project on CrowdIn platform
+at webpage and find your language,
+once done, look for the **Gear** project.
+
+## Compiling translations
+
+To convert all `.ts` files to `.qm` files (merge) you can use this command:
+
+```shell
+./update_translation.sh -R
+```
+
+If you are a translator that wants to update only their language file
+to test it on **FreeCAD** before doing a PR you can use this command:
+
+```shell
+./update_translation.sh -r de
+```
+
+This will update the `.qm` file for your language (German in this case).
+
+## Sending translations
+
+Now you can contribute your translated `.ts` file to **Gear** repository,
+also include the `.qm` file.
+
+
+
+## More information
+
+You can read more about translating external workbenches here:
+
+
diff --git a/freecad/gears/translations/update_translation.sh b/freecad/gears/translations/update_translation.sh
index 6375972..37f6f7d 100755
--- a/freecad/gears/translations/update_translation.sh
+++ b/freecad/gears/translations/update_translation.sh
@@ -2,9 +2,9 @@
# --------------------------------------------------------------------------------------------------
#
-# Update translation files
+# Create, update and release translation files.
#
-# Supported locales on FreeCAD <2024-01-20, FreeCADGui.supportedLocales(), total=40>:
+# Supported locales on FreeCAD <2024-09-12, FreeCADGui.supportedLocales(), total=43>:
# {'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu', 'Belarusian': 'be',
# 'Bulgarian': 'bg', 'Catalan': 'ca', 'Chinese Simplified': 'zh-CN',
# 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr', 'Czech': 'cs', 'Dutch': 'nl',
@@ -16,24 +16,33 @@
# 'Slovenian': 'sl', 'Spanish': 'es-ES', 'Spanish, Argentina': 'es-AR', 'Swedish': 'sv-SE',
# 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES', 'Vietnamese': 'vi'}
#
-# NOTE: WORKFLOW
-# 0. Install Qt tools
+# NOTE: PREPARATION
+# - Install Qt tools
# Debian-based (e.g., Ubuntu): $ sudo apt-get install qttools5-dev-tools pyqt6-dev-tools
# Fedora-based: $ sudo dnf install qt6-linguist qt6-devel
# Arch-based: $ sudo pacman -S qt6-tools python-pyqt6
-# 1. Make the script executable
+# - Make the script executable
# $ chmod +x update_translation.sh
-# 2. Execute the script passing the locale code as first parameter
-# The script has to be executed within the `resources/translations` directory
-# Only update the files you're translating!
-# $ ./update_translation.sh es-ES
-# 3. Do the translation via Qt Linguist and use `File>Release`
-# 4. If releasing with the script execute the script passing the locale code
-# as first parameter and use '-r' flag next
-# $ ./update_translation.sh es-ES -r
+# - The script has to be executed within the `freecad/gears/translations` directory.
+# Executing the script with no flags invokes the help.
+# $ ./update_translation.sh
#
-# The usage of `pylupdate6` is preferred over 'pylupdate5' when extracting text strings from
-# Python files.
+# NOTE: WORKFLOW TRANSLATOR (LOCAL)
+# - Execute the script passing the `-u` flag plus locale code as argument
+# Only update the file(s) you're translating!
+# $ ./update_translation.sh -u es-ES
+# - Do the translation via Qt Linguist and use `File>Release`
+# - If releasing with the script execute it passing the `-r` flag
+# plus locale code as argument
+# $ ./update_translation.sh -r es-ES
+#
+# NOTE: WORKFLOW MAINTAINER (CROWDIN)
+# - Execute the script passing the '-U' flag
+# $ ./update_translation.sh -U
+# - Upload the updated file to Crowdin and wait for translators do their thing ;-)
+# - Once done, download the translated files, copy them to `freecad/gears/translations`
+# and release all the files to update the changes
+# $ ./update_translation.sh -R
#
# --------------------------------------------------------------------------------------------------
@@ -41,68 +50,90 @@ supported_locales=(
"en" "af" "ar" "eu" "be" "bg" "ca" "zh-CN" "zh-TW" "hr"
"cs" "nl" "fil" "fi" "fr" "gl" "ka" "de" "el" "hu"
"id" "it" "ja" "kab" "ko" "lt" "no" "pl" "pt-PT" "pt-BR"
- "ro" "ru" "sr" "es-ES" "es-AR" "sv-SE" "tr" "uk" "val-ES" "vi"
+ "ro" "ru" "sr" "sr-CS" "sk" "sl" "es-ES" "es-AR" "sv-SE" "tr"
+ "uk" "val-ES" "vi"
)
is_locale_supported() {
local locale="$1"
for supported_locale in "${supported_locales[@]}"; do
- if [[ "$supported_locale" == "$locale" ]]; then
- return 0
- fi
+ [ "$supported_locale" == "$locale" ] && return 0
done
return 1
}
-get_strings() {
- # Get translatable strings from ../../*.py Python files
- pylupdate6 ../*.py -ts pyfiles.ts
-}
-
-delete_files() {
- # Delete files that are no longer needed
- rm pyfiles.ts
- rm -f ${WB}.ts
-}
-
-add_new_locale() {
- echo -e "\033[1;33m\n\t<<< Creating '${WB}_${LOCALE}.ts' file >>>\n\033[m"
- get_strings
- # Join strings from Qt Designer and Python files
- lconvert -source-language en -target-language $LOCALE \
- -i pyfiles.ts -o ${WB}_${LOCALE}.ts
-}
-
update_locale() {
- echo -e "\033[1;32m\n\t<<< Updating '${WB}_${LOCALE}.ts' file >>>\n\033[m"
- get_strings
- # Join newly created file with older file ( -no-obsolete)
- lconvert -source-language en -target-language $LOCALE \
- -i pyfiles.ts ${WB}_${LOCALE}.ts -o ${WB}_${LOCALE}.ts -no-obsolete
+ local locale="$1"
+ local u=${locale:+_} # Conditional underscore
+
+ # NOTE: Execute the right commands depending on:
+ # - if it's a locale file or the main, agnostic one
+ [ ! -f "${WB}${u}${locale}.ts" ] && action="Creating" || action="Updating"
+ echo -e "\033[1;34m\n\t<<< ${action} '${WB}${u}${locale}.ts' file >>>\n\033[m"
+ if [ "$u" == "" ]; then
+ $LUPDATE ../*.py -ts "${WB}.ts" # locale-agnostic file
+ else
+ $LUPDATE ../*.py -source-language en -target-language "${locale//-/_}" \
+ -ts "${WB}_${locale}.ts"
+ fi
}
-release_translation() {
- # Release translation (creation of *.qm file from *.ts file)
- lrelease ${WB}_${LOCALE}.ts
+help() {
+ echo -e "\nDescription:"
+ echo -e "\tCreate, update and release translation files."
+ echo -e "\nUsage:"
+ echo -e "\t./update_translation.sh [-R] [-U] [-r ] [-u ]"
+ echo -e "\nFlags:"
+ echo -e " -R\n\tRelease all locales"
+ echo -e " -U\n\tUpdate main translation file (locale agnostic)"
+ echo -e " -r \n\tRelease the specified locale"
+ echo -e " -u \n\tUpdate strings for the specified locale"
}
# Main function ------------------------------------------------------------------------------------
+LUPDATE=/usr/lib/qt6/bin/lupdate # from Qt6
+# LUPDATE=lupdate # from Qt5
+LRELEASE=/usr/lib/qt6/bin/lrelease # from Qt6
+# LRELEASE=lrelease # from Qt5
WB="Gear"
-LOCALE="$1"
-if is_locale_supported "$LOCALE"; then
- if [ "$2" == "-r" ]; then
- release_translation
+# Enforce underscore on locales
+sed -i '3s/-/_/' ${WB}*.ts
+
+if [ $# -eq 1 ]; then
+ if [ "$1" == "-R" ]; then
+ find . -type f -name '*_*.ts' | while IFS= read -r file; do
+ # Release all locales
+ $LRELEASE "$file"
+ echo
+ done
+ elif [ "$1" == "-U" ]; then
+ # Update main file (agnostic)
+ update_locale
else
- if [ ! -f "${WB}_${LOCALE}.ts" ]; then
- add_new_locale
- else
+ help
+ fi
+elif [ $# -eq 2 ]; then
+ LOCALE="$2"
+ if is_locale_supported "$LOCALE"; then
+ if [ "$1" == "-r" ]; then
+ # Release locale (creation of *.qm file from *.ts file)
+ $LRELEASE "${WB}_${LOCALE}.ts"
+ elif [ "$1" == "-u" ]; then
+ # Update main & locale files
update_locale
+ update_locale "$LOCALE"
fi
- delete_files
+ else
+ echo "Verify your language code. Case sensitive."
+ echo "If it's correct, ask a maintainer to add support for your language on FreeCAD."
+ echo -e "Supported locales, '\033[1;34mFreeCADGui.supportedLocales()\033[m': \033[1;33m"
+ for locale in $(printf "%s\n" "${supported_locales[@]}" | sort); do
+ echo -n "$locale "
+ done
+ echo
fi
else
- echo "Verify your language code. Case sensitive."
- echo "If it's correct ask a maintainer to add support for your language on FreeCAD."
+ help
fi