Commit 78d2525b authored by Gus Grubba's avatar Gus Grubba
Browse files

Automated the ingestion of localization from Crowdin

Automated the generation of language resources into the application
Added all languages that come from Crowdin, even if empty.
Allow dynamic language changes
parent 9d255f45
......@@ -55,6 +55,7 @@ libs/thirdParty/libxbee/lib/
GeneratedFiles/
gstreamer-1.0-android*
src/Airmap/Airmap_api_key.h
localization/qgroundcontrol/
*.autosave
.settings/
......
......@@ -6,6 +6,10 @@ Note: This file only contains high level features or important fixes.
### 3.6.0 - Daily Build
* Automated the ingestion of localization from Crowdin
* Automated the generation of language resources into the application
* Added all languages that come from Crowdin, even if empty.
* Allow dynamic language changes
* Check and respect camera storage status
* QGC now requires Qt 5.11 or greater. The idea is to standardize on Qt 5.12 (LTS). Just waiting for a solution for Windows as Qt dropped support for 32-bit.
* New, QtQuick MAVLink Inspector. The basics are already there but it still needs the ability to filter compID.
......
To generate (or update) a source translation file, use the "lupdate" command line tool. It can be found in the Qt distribution.
To generate (or update) a source translation file, use the `to-crowdin.sh` script in this directory. You will need to update the path to Qt within it.
(Easiest to just run the `gen_translation_source.sh` script, or get the commands from within the script and run them manually)
This will parse all the source files and generate a language translation file called qgc.ts, which should be uploaded to crowdin.
This will parse all the source files and generate a language translation file called qgc.ts. This file should be copied into whatever language it is to be translated to and sent to translation. The translation can either be done directly within the (XML) file, using Qt's "Linguist" tool, or uploaded to crowdin.
For instance, to localize to Germany German as an example you first copy the original source:
```
cp qgc.ts qgc_de-DE.ts
```
The German localization is then performed in qgc_de-DE.ts
Once localization is complete, you "compile" it using the "lrelease" command line tool.
```
lrelease qgc_de-DE.ts
```
This will generate the ("compiled") localization file `qgc_de-DE.qm`, which should be shipped with QGroundControl.
Further documentation can be found at:
http://doc.qt.io/qt-5/qtlinguist-index.html
Note about crowdin:
If you build the project and download the resulting ZIP file, the translated (.ts) files all come with the same name "qgc.ts". They each reside in a different directory named after the language for which it was translated into. Care must be taken to rename these files before moving them to the locale directory so you don't override the original, English source file.
Once translations have been done/updated, within Crowdin "Build and Download". Extract the resulting qgroundcontro.zip here and run `from-crowdin.py`.
#!/bin/bash
for f in *.ts
do
/Users/gus/Applications/Qt/5.11.2/clang_64/bin/lrelease $f
done
\ No newline at end of file
#!/usr/bin/env python
import os
from shutil import copyfile
# When you "Build and Download" from Crowdin, you endup with a qgroundcontro.zip file.
# It is assumed this zip file has been extracted into ./qgroundcontrol
for lang in os.listdir("./qgroundcontrol"):
srcFile = os.path.join("./qgroundcontrol", lang, "qgc.ts")
if(os.path.exists(srcFile)):
lang = lang.replace("-","_")
dstFile = "./qgc" + "_" + lang + ".ts"
print("qgc" + "_" + lang + ".ts")
copyfile(srcFile, dstFile)
<d!`
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment