Update translation script and add locale-agnostic file

Also include `translations/README.md` file with instructions.
This commit is contained in:
hasecilu
2024-09-11 09:40:33 -06:00
committed by lorenz
parent 7911050526
commit 1b2981c6cf
3 changed files with 915 additions and 56 deletions

View File

@@ -0,0 +1,712 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>App::Property</name>
<message>
<location filename="../basegear.py" line="104"/>
<location filename="../connector.py" line="72"/>
<source>freecad.gears-version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="45"/>
<location filename="../crowngear.py" line="44"/>
<location filename="../cycloidgear.py" line="47"/>
<location filename="../cycloidgearrack.py" line="42"/>
<location filename="../internalinvolutegear.py" line="59"/>
<location filename="../involutegear.py" line="86"/>
<location filename="../involutegearrack.py" line="40"/>
<location filename="../lanterngear.py" line="40"/>
<location filename="../timinggear.py" line="112"/>
<location filename="../timinggear_t.py" line="46"/>
<location filename="../wormgear.py" line="41"/>
<source>number of teeth</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="51"/>
<location filename="../crowngear.py" line="62"/>
<location filename="../cycloidgear.py" line="59"/>
<location filename="../cycloidgearrack.py" line="48"/>
<location filename="../hypocycloidgear.py" line="105"/>
<location filename="../hypocycloidgear.py" line="130"/>
<location filename="../internalinvolutegear.py" line="74"/>
<location filename="../involutegear.py" line="101"/>
<location filename="../involutegearrack.py" line="46"/>
<location filename="../lanterngear.py" line="58"/>
<location filename="../timinggear.py" line="124"/>
<location filename="../wormgear.py" line="53"/>
<source>height</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="57"/>
<source>pitch_angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="63"/>
<source>pressure_angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="69"/>
<location filename="../crowngear.py" line="56"/>
<location filename="../cycloidgear.py" line="53"/>
<location filename="../involutegearrack.py" line="52"/>
<location filename="../lanterngear.py" line="46"/>
<location filename="../wormgear.py" line="47"/>
<source>module</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="75"/>
<location filename="../cycloidgear.py" line="136"/>
<location filename="../internalinvolutegear.py" line="225"/>
<location filename="../involutegear.py" line="231"/>
<source>clearance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="81"/>
<location filename="../cycloidgear.py" line="65"/>
<location filename="../cycloidgearrack.py" line="70"/>
<location filename="../internalinvolutegear.py" line="86"/>
<location filename="../involutegear.py" line="253"/>
<source>number of points for spline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="90"/>
<source>if value is true the gears outer face will match the z=0 plane</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="99"/>
<location filename="../cycloidgear.py" line="145"/>
<location filename="../internalinvolutegear.py" line="204"/>
<location filename="../involutegear.py" line="219"/>
<location filename="../timinggear_t.py" line="69"/>
<source>The arc length on the pitch circle by which the tooth thicknes is reduced.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="105"/>
<location filename="../cycloidgearrack.py" line="76"/>
<location filename="../internalinvolutegear.py" line="92"/>
<location filename="../involutegearrack.py" line="73"/>
<source>test</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="111"/>
<source>angle used for spiral bevel-gears</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="117"/>
<location filename="../cycloidgear.py" line="179"/>
<location filename="../internalinvolutegear.py" line="144"/>
<location filename="../involutegear.py" line="185"/>
<source>The pitch diameter.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bevelgear.py" line="132"/>
<location filename="../cycloidgear.py" line="194"/>
<location filename="../internalinvolutegear.py" line="153"/>
<location filename="../involutegear.py" line="195"/>
<source>The angle by which this gear can turn without moving the mating gear.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../connector.py" line="79"/>
<source>master gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../connector.py" line="86"/>
<source>slave gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../connector.py" line="93"/>
<location filename="../connector.py" line="100"/>
<source>angle at which second gear is placed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="50"/>
<source>number of teeth of other gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="68"/>
<location filename="../cycloidgearrack.py" line="54"/>
<location filename="../internalinvolutegear.py" line="80"/>
<location filename="../involutegearrack.py" line="58"/>
<source>thickness</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="74"/>
<location filename="../internalinvolutegear.py" line="239"/>
<location filename="../involutegear.py" line="107"/>
<location filename="../involutegearrack.py" line="160"/>
<location filename="../wormgear.py" line="72"/>
<source>pressure angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="101"/>
<location filename="../lanterngear.py" line="64"/>
<source>number of profiles used for loft</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="107"/>
<source>if true no boolean operation is done</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="71"/>
<source>the python object</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="102"/>
<location filename="../cycloidgearrack.py" line="110"/>
<location filename="../internalinvolutegear.py" line="253"/>
<location filename="../involutegear.py" line="162"/>
<location filename="../involutegearrack.py" line="116"/>
<source>double helix</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="108"/>
<location filename="../cycloidgearrack.py" line="104"/>
<location filename="../internalinvolutegear.py" line="247"/>
<location filename="../involutegear.py" line="156"/>
<location filename="../involutegearrack.py" line="110"/>
<location filename="../wormgear.py" line="65"/>
<source>beta</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="119"/>
<location filename="../cycloidgearrack.py" line="175"/>
<location filename="../internalinvolutegear.py" line="184"/>
<location filename="../involutegear.py" line="130"/>
<location filename="../involutegearrack.py" line="171"/>
<location filename="../timinggear_t.py" line="78"/>
<source>a fillet for the tooth-head, radius = head_fillet x module</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="128"/>
<location filename="../cycloidgearrack.py" line="184"/>
<location filename="../internalinvolutegear.py" line="193"/>
<location filename="../involutegear.py" line="139"/>
<location filename="../involutegearrack.py" line="180"/>
<location filename="../timinggear_t.py" line="87"/>
<source>a fillet for the tooth-root, radius = root_fillet x module</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="153"/>
<location filename="../internalinvolutegear.py" line="219"/>
<location filename="../involutegear.py" line="239"/>
<source>head_value * module_value = additional length of head</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="163"/>
<location filename="../cycloidgearrack.py" line="156"/>
<source>inner_diameter divided by module (hypocycloid)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgear.py" line="171"/>
<location filename="../cycloidgearrack.py" line="164"/>
<source>outer_diameter divided by module (epicycloid)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgearrack.py" line="64"/>
<location filename="../involutegearrack.py" line="67"/>
<source>if enabled the rack is drawn with a constant number of teeth to avoid topologic renaming.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgearrack.py" line="118"/>
<location filename="../involutegearrack.py" line="124"/>
<source>pitch in the transverse plane</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgearrack.py" line="128"/>
<location filename="../involutegearrack.py" line="134"/>
<source>if enabled the total length of the rack is teeth x pitch, otherwise the rack starts with a tooth-flank</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgearrack.py" line="138"/>
<location filename="../involutegearrack.py" line="144"/>
<location filename="../lanterngear.py" line="72"/>
<location filename="../wormgear.py" line="86"/>
<source>head * module = additional length of head</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../cycloidgearrack.py" line="146"/>
<location filename="../involutegearrack.py" line="152"/>
<location filename="../wormgear.py" line="94"/>
<source>clearance * module = additional length of root</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="48"/>
<source>Pin ball circle radius (overrides Tooth Pitch)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="54"/>
<source>Roller Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="60"/>
<source>Eccentricity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="66"/>
<source>Pressure angle limit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="72"/>
<source>Offset in pressure angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="78"/>
<source>Number of teeth in Cam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="86"/>
<source>Number of points used for spline interpolation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="92"/>
<source>Center hole&apos;s radius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="99"/>
<source>Create pins in place</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="111"/>
<source>Center pin Z axis to generated disks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="118"/>
<source>Show main cam disk</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="124"/>
<source>Show another reversed cam disk on top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="53"/>
<location filename="../involutegear.py" line="247"/>
<source>simple</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="68"/>
<location filename="../involutegear.py" line="95"/>
<source>normal module if properties_from_tool=True, else it&apos;s the transverse module.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="128"/>
<source>inside diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="135"/>
<location filename="../involutegear.py" line="177"/>
<source>root diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="165"/>
<location filename="../involutegear.py" line="207"/>
<source>transverse_pitch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="172"/>
<source>Outside diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="210"/>
<location filename="../involutegear.py" line="225"/>
<source>backlash direction</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="233"/>
<location filename="../involutegear.py" line="113"/>
<source>shift</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../internalinvolutegear.py" line="262"/>
<location filename="../involutegear.py" line="150"/>
<location filename="../involutegearrack.py" line="104"/>
<source>if beta is given and properties_from_tool is enabled, gear parameters are internally recomputed for the rotated gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../involutegear.py" line="49"/>
<source>python gear object</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../involutegear.py" line="121"/>
<source>undercut</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../involutegear.py" line="170"/>
<source>outside diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../involutegear.py" line="261"/>
<source>traverse module of the generated gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lanterngear.py" line="52"/>
<source>the bolt radius of the rack/chain</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="118"/>
<source>type of timing-gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="130"/>
<location filename="../timinggear_t.py" line="40"/>
<source>pitch of gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="137"/>
<source>radial height of teeth</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="147"/>
<source>radial difference between pitch diameter and head of gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="154"/>
<source>radius of first arc</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="161"/>
<source>radius of second arc</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="168"/>
<source>radius of third arc</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear.py" line="175"/>
<source>x-offset of second arc-midpoint</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear_t.py" line="52"/>
<source>radial height of tooth</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear_t.py" line="60"/>
<source>radial distance from tooth-head to pitch circle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear_t.py" line="93"/>
<source>angle of tooth flanks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../timinggear_t.py" line="99"/>
<source>extrusion height</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wormgear.py" line="59"/>
<source>diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wormgear.py" line="78"/>
<source>reverse rotation of helix</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_BevelGear</name>
<message>
<location filename="../commands.py" line="159"/>
<source>Bevel Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="162"/>
<source>Create a Bevel gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_CrownGear</name>
<message>
<location filename="../commands.py" line="143"/>
<source>Crown Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="146"/>
<source>Create a Crown gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_CycloidGear</name>
<message>
<location filename="../commands.py" line="151"/>
<source>Cycloid Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="154"/>
<source>Create a Cycloid gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_CycloidRack</name>
<message>
<location filename="../commands.py" line="135"/>
<source>Cycloid Rack</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="138"/>
<source>Create an Cycloid rack</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_GearConnector</name>
<message>
<location filename="../commands.py" line="209"/>
<location filename="../commands.py" line="211"/>
<source>Combine two gears</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_HypoCycloidGear</name>
<message>
<location filename="../commands.py" line="167"/>
<source>HypoCycloid Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="172"/>
<source>Create a HypoCycloid gear with its pins</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_InternalInvoluteGear</name>
<message>
<location filename="../commands.py" line="117"/>
<source>Internal Involute Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="122"/>
<source>Create an internal involute gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_InvoluteGear</name>
<message>
<location filename="../commands.py" line="105"/>
<source>Involute Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="110"/>
<source>Create an external involute gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_InvoluteRack</name>
<message>
<location filename="../commands.py" line="127"/>
<source>Involute Rack</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="130"/>
<source>Create an Involute rack</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_LanternGear</name>
<message>
<location filename="../commands.py" line="201"/>
<source>Lantern Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="204"/>
<source>Create a Lantern gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_TimingGear</name>
<message>
<location filename="../commands.py" line="193"/>
<source>Timing Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="196"/>
<source>Create a Timing gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_TimingGearT</name>
<message>
<location filename="../commands.py" line="185"/>
<source>Timing Gear T-shape</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="188"/>
<source>Create a Timing gear T-shape</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FCGear_WormGear</name>
<message>
<location filename="../commands.py" line="177"/>
<source>Worm Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="180"/>
<source>Create a Worm gear</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
<message>
<location filename="../commands.py" line="218"/>
<source>Please select two gear objects.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../commands.py" line="224"/>
<source>Selected object is not a gear.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../crowngear.py" line="94"/>
<source>Gear module: Crown gear created, preview_mode = true for improved performance. Set preview_mode property to false when ready to cut teeth.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="227"/>
<source>Generating cam disk
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="269"/>
<source>Generating secondary cam disk
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../hypocycloidgear.py" line="287"/>
<source>Generating pins
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../init_gui.py" line="39"/>
<source>Checking FreeCAD version
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../init_gui.py" line="73"/>
<source>FreeCAD version (currently {}.{}.{} ({})) must be at least {}.{}.{} ({}) in order to work with Python 3.11 and above
</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../basegear.py" line="140"/>
<source>Migrating &apos;teeth&apos; property to &apos;num_teeth&apos; on {} part
</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Workbench</name>
<message>
<location filename="../init_gui.py" line="90"/>
<location filename="../init_gui.py" line="129"/>
<location filename="../init_gui.py" line="130"/>
<source>Gear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../init_gui.py" line="91"/>
<source>Gear Workbench</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -0,0 +1,116 @@
# About translating Gear Workbench
<!--toc:start-->
- [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)
<!--toc:end-->
> [!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 <https://crowdin.com/project/freecad-addons> 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
<TS version="2.1">
```
to
```xml
<TS version="2.1" language="de" sourcelanguage="en">
```
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 <https://crowdin.com/project/freecad-addons> 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.
<https://github.com/looooo/freecad.gears>
## More information
You can read more about translating external workbenches here:
<https://wiki.freecad.org/Translating_an_external_workbench>

View File

@@ -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 <locale>] [-u <locale>]"
echo -e "\nFlags:"
echo -e " -R\n\tRelease all locales"
echo -e " -U\n\tUpdate main translation file (locale agnostic)"
echo -e " -r <locale>\n\tRelease the specified locale"
echo -e " -u <locale>\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