Commit 398e7cf4 authored by Gus Grubba's avatar Gus Grubba

Initial localization work.

parent e8cce68c
To generate (or update) a source translation file, use the "lupdate" command line tool. It can be found in the Qt distribution.
(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. 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.
#!/bin/bash
# This is set to find lupdate in my particular installation. You will need to set the path
# where you have Qt installed.
QT_PATH=~/Applications/Qt/5.7/clang_64/bin
$QT_PATH/lupdate ../src -ts qgc.ts
This diff is collapsed.
......@@ -38,7 +38,7 @@ GeoTagController::~GeoTagController()
void GeoTagController::pickLogFile(void)
{
QString filename = QGCQFileDialog::getOpenFileName(MainWindow::instance(), "Select log file load", QString(), "ULog file (*.ulg);;PX4 log file (*.px4log);;All Files (*.*)");
QString filename = QGCQFileDialog::getOpenFileName(MainWindow::instance(), tr("Select log file load"), QString(), tr("ULog file (*.ulg);;PX4 log file (*.px4log);;All Files (*.*)"));
if (!filename.isEmpty()) {
_worker.setLogFile(filename);
emit logFileChanged(filename);
......@@ -47,7 +47,7 @@ void GeoTagController::pickLogFile(void)
void GeoTagController::pickImageDirectory(void)
{
QString dir = QGCQFileDialog::getExistingDirectory(MainWindow::instance(), "Select image directory");
QString dir = QGCQFileDialog::getExistingDirectory(MainWindow::instance(), tr("Select image directory"));
if (!dir.isEmpty()) {
_worker.setImageDirectory(dir);
emit imageDirectoryChanged(dir);
......@@ -56,7 +56,7 @@ void GeoTagController::pickImageDirectory(void)
void GeoTagController::pickSaveDirectory(void)
{
QString dir = QGCQFileDialog::getExistingDirectory(MainWindow::instance(), "Select save directory");
QString dir = QGCQFileDialog::getExistingDirectory(MainWindow::instance(), tr("Select save directory"));
if (!dir.isEmpty()) {
_worker.setSaveDirectory(dir);
emit saveDirectoryChanged(dir);
......
......@@ -95,7 +95,7 @@ QGCLogEntry::QGCLogEntry(uint logId, const QDateTime& dateTime, uint logSize, bo
, _received(received)
, _selected(false)
{
_status = "Pending";
_status = tr("Pending");
}
//----------------------------------------------------------------------------------------
......@@ -180,7 +180,7 @@ LogDownloadController::_logEntry(UASInterface* uas, uint32_t time_utc, uint32_t
entry->setSize(size);
entry->setTime(QDateTime::fromTime_t(time_utc));
entry->setReceived(true);
entry->setStatus(QString("Available"));
entry->setStatus(QString(tr("Available")));
} else {
qWarning() << "Received log entry for out-of-bound index:" << id;
}
......@@ -227,7 +227,7 @@ LogDownloadController::_resetSelection(bool canceled)
if(entry) {
if(entry->selected()) {
if(canceled) {
entry->setStatus(QString("Canceled"));
entry->setStatus(QString(tr("Canceled")));
}
entry->setSelected(false);
}
......@@ -274,7 +274,7 @@ LogDownloadController::_findMissingEntries()
for(int i = 0; i < num_logs; i++) {
QGCLogEntry* entry = _logEntriesModel[i];
if(entry && !entry->received()) {
entry->setStatus(QString("Error"));
entry->setStatus(QString(tr("Error")));
}
}
//-- Give up
......@@ -360,7 +360,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
_timer.start(timeout_time);
//-- Do we have it all?
if(_logComplete()) {
_downloadData->entry->setStatus(QString("Downloaded"));
_downloadData->entry->setStatus(QString(tr("Downloaded")));
//-- Check for more
_receivedAllData();
} else if (_chunkComplete()) {
......@@ -379,7 +379,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
qWarning() << "Received log offset greater than expected";
}
if(!result) {
_downloadData->entry->setStatus(QString("Error"));
_downloadData->entry->setStatus(QString(tr("Error")));
}
}
......@@ -425,7 +425,7 @@ LogDownloadController::_findMissingData()
}
if(_retries++ > 2) {
_downloadData->entry->setStatus(QString("Timed Out"));
_downloadData->entry->setStatus(QString(tr("Timed Out")));
//-- Give up
qWarning() << "Too many errors retreiving log data. Giving up.";
_receivedAllData();
......@@ -516,7 +516,7 @@ LogDownloadController::download(QString path)
if(dir.isEmpty()) {
dir = QGCQFileDialog::getExistingDirectory(
MainWindow::instance(),
"Log Download Directory",
tr("Log Download Directory"),
QDir::homePath(),
QGCQFileDialog::ShowDirsOnly | QGCQFileDialog::DontResolveSymlinks);
}
......@@ -543,7 +543,7 @@ void LogDownloadController::downloadToDirectory(const QString& dir)
QGCLogEntry* entry = _logEntriesModel[i];
if(entry) {
if(entry->selected()) {
entry->setStatus(QString("Waiting"));
entry->setStatus(QString(tr("Waiting")));
}
}
}
......@@ -634,7 +634,7 @@ LogDownloadController::_prepareLogDownload()
if (_downloadData->file.exists()) {
_downloadData->file.remove();
}
_downloadData->entry->setStatus(QString("Error"));
_downloadData->entry->setStatus(QString(tr("Error")));
delete _downloadData;
_downloadData = NULL;
}
......@@ -688,7 +688,7 @@ LogDownloadController::cancel(void)
_receivedAllEntries();
}
if(_downloadData) {
_downloadData->entry->setStatus(QString("Canceled"));
_downloadData->entry->setStatus(QString(tr("Canceled")));
if (_downloadData->file.exists()) {
_downloadData->file.remove();
}
......
#include "ULogParser.h"
#include "ULogParser.h"
#include <math.h>
#include <QDateTime>
......
......@@ -15,6 +15,7 @@
#error Should not be included in mobile builds
#endif
#include <QCoreApplication>
#include <QFileDialog>
/// @file
......@@ -40,7 +41,7 @@
*/
class QGCQFileDialog : public QFileDialog {
Q_DECLARE_TR_FUNCTIONS(QGCQFileDialog)
public:
//! Static helper that will return an existing directory selected by the user.
......
Markdown is supported
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