Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Localization Support #182

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gui/src/HeadTracker.pro
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ FORMS += \
firmwarewizard.ui \
mainwindow.ui

#Localization
CONFIG += lrelease
CONFIG += embed_translations
TRANSLATIONS += \
i18n/HeadTracker_en_US.ts \
i18n/HeadTracker_zh_CN.ts

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /usr/bin
Expand Down
242 changes: 121 additions & 121 deletions gui/src/basetrackersettings.h
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be changed in buildguisettings.py. It's an autogenerated file from a python script buildguisettings.py

image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I might have to re-think this as the line numbers for the translation file may change. Might have to move the translations into the settings.csv file.

Original file line number Diff line number Diff line change
Expand Up @@ -189,127 +189,127 @@ class BaseTrackerSettings : public QObject
_dataItems["rolloff"] = false;
_dataItems["panoff"] = false;
_dataItems["gyrocal"] = false;
descriptions["rll_min"] = "Roll Minimum";
descriptions["rll_max"] = "Roll Maximum";
descriptions["rll_cnt"] = "Roll Center";
descriptions["rll_gain"] = "Roll Gain";
descriptions["tlt_min"] = "Tilt Minimum";
descriptions["tlt_max"] = "Tilt Maximum";
descriptions["tlt_cnt"] = "Tilt Center";
descriptions["tlt_gain"] = "Tilt Gain";
descriptions["pan_min"] = "Pan Minimum";
descriptions["pan_max"] = "Pan Maximum";
descriptions["pan_cnt"] = "Pan Center";
descriptions["pan_gain"] = "Pan Gain";
descriptions["tltch"] = "Tilt Output Channel";
descriptions["rllch"] = "Roll Output Channel";
descriptions["panch"] = "Pan Output Channel";
descriptions["alertch"] = "Alert Output Channel";
descriptions["pwm0"] = "PWM 0 Channel";
descriptions["pwm1"] = "PWM 1 Channel";
descriptions["pwm2"] = "PWM 2 Channel";
descriptions["pwm3"] = "PWM 3 Channel";
descriptions["an0ch"] = "Analog 0 Channel";
descriptions["an1ch"] = "Analog 1 Channel";
descriptions["an2ch"] = "Analog 2 Channel";
descriptions["an3ch"] = "Analog 3 Channel";
descriptions["aux0ch"] = "Auxilary Function 0 Channel";
descriptions["aux1ch"] = "Auxilary Function 1 Channel";
descriptions["aux2ch"] = "Auxilary Function 2 Channel";
descriptions["rstppm"] = "Reset Center on PPM Input Channel";
descriptions["aux0func"] = "Auxilary Function 0";
descriptions["aux1func"] = "Auxilary Function 1";
descriptions["aux2func"] = "Auxilary Function 2";
descriptions["an0gain"] = "Analog 0 Gain";
descriptions["an1gain"] = "Analog 1 Gain";
descriptions["an2gain"] = "Analog 2 Gain";
descriptions["an3gain"] = "Analog 3 Gain";
descriptions["an0off"] = "Analog 0 Offset";
descriptions["an1off"] = "Analog 1 Offset";
descriptions["an2off"] = "Analog 2 Offset";
descriptions["an3off"] = "Analog 3 Offset";
descriptions["servoreverse"] = "Servo Reverse (BitMask)";
descriptions["magxoff"] = "Magnetometer X Calibration Offset";
descriptions["magyoff"] = "Magnetometer Y Calibration Offset";
descriptions["magzoff"] = "Magnetometer Z Calibration Offset";
descriptions["accxoff"] = "Accelerometer X Calibration Offset";
descriptions["accyoff"] = "Accelerometer Y Calibration Offset";
descriptions["acczoff"] = "Accelerometer Z Calibration Offset";
descriptions["gyrxoff"] = "Gyrometer X Calibration Offset";
descriptions["gyryoff"] = "Gyrometer Y Calibration Offset";
descriptions["gyrzoff"] = "Gyrometer Z Calibration Offset";
descriptions["so00"] = "Soft Iron Offset 00";
descriptions["so01"] = "Soft Iron Offset 01";
descriptions["so02"] = "Soft Iron Offset 02";
descriptions["so10"] = "Soft Iron Offset 10";
descriptions["so11"] = "Soft Iron Offset 11";
descriptions["so12"] = "Soft Iron Offset 12";
descriptions["so20"] = "Soft Iron Offset 20";
descriptions["so21"] = "Soft Iron Offset 21";
descriptions["so22"] = "Soft Iron Offset 22";
descriptions["dismag"] = "Disable Magnetometer";
descriptions["rotx"] = "Board Rotation X";
descriptions["roty"] = "Board Rotation Y";
descriptions["rotz"] = "Board Rotation Z";
descriptions["uartmode"] = "Uart Mode (0- Off, 1-SBUS, 2-CRSFIN, 3-CRSFOUT)";
descriptions["crsftxrate"] = "CRSF Transmit Frequncy";
descriptions["sbustxrate"] = "SBUS Transmit Freqency";
descriptions["sbininv"] = "SBUS Receieve Inverted";
descriptions["sboutinv"] = "SBUS Transmit Inverted";
descriptions["crsftxinv"] = "Invert CRSF output";
descriptions["ch5arm"] = "Set channel 5 to 2000us";
descriptions["btmode"] = "Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, BT_HID_Joystick)";
descriptions["rstonwave"] = "Reset on Proximity Sense";
descriptions["butlngps"] = "Long Press on the Button to Enable/Disable Tilt Roll and Pan";
descriptions["rstontlt"] = "Reset Center on a Head Tilt";
descriptions["rstondblttap"] = "Reset on a double tap";
descriptions["rstondbltapthres"] = "Double Tap Threshold";
descriptions["rstondbltapmin"] = "Double Tap Min Time";
descriptions["rstondbltapmax"] = "Double Tap Max Time";
descriptions["ppmoutinvert"] = "Invert PPM Output";
descriptions["ppmininvert"] = "Invert PPM Output";
descriptions["ppmframe"] = "PPM Frame Length (us)";
descriptions["ppmsync"] = "PPM Sync Pulse Length (us)";
descriptions["ppmchcnt"] = "PPM channels to output";
descriptions["magx"] = "Raw Sensor Mag X";
descriptions["magy"] = "Raw Sensor Mag Y";
descriptions["magz"] = "Raw Sensor Mag Z";
descriptions["gyrox"] = "Raw Sensor Gyro X";
descriptions["gyroy"] = "Raw Sensor Gyro Y";
descriptions["gyroz"] = "Raw Sensor Gyro Z";
descriptions["accx"] = "Raw Sensor Accel X";
descriptions["accy"] = "Raw Sensor Accel Y";
descriptions["accz"] = "Raw Sensor Accel Z";
descriptions["off_magx"] = "Calibrated Mag X";
descriptions["off_magy"] = "Calibrated Mag Y";
descriptions["off_magz"] = "Calibrated Mag Z";
descriptions["off_gyrox"] = "Calibrated Gyro X";
descriptions["off_gyroy"] = "Calibrated Gyro Y";
descriptions["off_gyroz"] = "Calibrated Gyro Z";
descriptions["off_accx"] = "Calibrated Accel X";
descriptions["off_accy"] = "Calibrated Accel Y";
descriptions["off_accz"] = "Calibrated Accel Z";
descriptions["tiltout"] = "Board Tilt Output (us)";
descriptions["rollout"] = "Board Roll Output (us)";
descriptions["panout"] = "Board Pan Output (us)";
descriptions["iscal"] = "Has the board been Calibrated";
descriptions["btcon"] = "Bluetooth is connected";
descriptions["trpenabled"] = "Tilt/Roll/Pan Output Enabled";
descriptions["tilt"] = "Raw Tilt in Degrees";
descriptions["roll"] = "Raw Roll in Degrees";
descriptions["pan"] = "Raw Pan in Degrees";
descriptions["tiltoff"] = "Offset Tilt in Degrees";
descriptions["rolloff"] = "Offset Roll in Degrees";
descriptions["panoff"] = "Offset Pan in Degrees";
descriptions["gyrocal"] = "Gyro Has Been Calibrated";
descriptions["btpairedaddress"] = "Bluetooth Remote address to Pair With";
descriptions["chout"] = "Channel Outputs";
descriptions["btch"] = "Bluetooth Inputs";
descriptions["ppmch"] = "PPM Inputs";
descriptions["uartch"] = "Uart Channels (Sbus/Crsf)";
descriptions["quat"] = "Quaternion Output (Tilt / Roll / Pan)";
descriptions["btaddr"] = "Local Bluetooth Address";
descriptions["btrmt"] = "Remote Bluetooth Address";
descriptions["rll_min"] = tr("Roll Minimum");
descriptions["rll_max"] = tr("Roll Maximum");
descriptions["rll_cnt"] = tr("Roll Center");
descriptions["rll_gain"] = tr("Roll Gain");
descriptions["tlt_min"] = tr("Tilt Minimum");
descriptions["tlt_max"] = tr("Tilt Maximum");
descriptions["tlt_cnt"] = tr("Tilt Center");
descriptions["tlt_gain"] = tr("Tilt Gain");
descriptions["pan_min"] = tr("Pan Minimum");
descriptions["pan_max"] = tr("Pan Maximum");
descriptions["pan_cnt"] = tr("Pan Center");
descriptions["pan_gain"] = tr("Pan Gain");
descriptions["tltch"] = tr("Tilt Output Channel");
descriptions["rllch"] = tr("Roll Output Channel");
descriptions["panch"] = tr("Pan Output Channel");
descriptions["alertch"] = tr("Alert Output Channel");
descriptions["pwm0"] = tr("PWM 0 Channel");
descriptions["pwm1"] = tr("PWM 1 Channel");
descriptions["pwm2"] = tr("PWM 2 Channel");
descriptions["pwm3"] = tr("PWM 3 Channel");
descriptions["an0ch"] = tr("Analog 0 Channel");
descriptions["an1ch"] = tr("Analog 1 Channel");
descriptions["an2ch"] = tr("Analog 2 Channel");
descriptions["an3ch"] = tr("Analog 3 Channel");
descriptions["aux0ch"] = tr("Auxilary Function 0 Channel");
descriptions["aux1ch"] = tr("Auxilary Function 1 Channel");
descriptions["aux2ch"] = tr("Auxilary Function 2 Channel");
descriptions["rstppm"] = tr("Reset Center on PPM Input Channel");
descriptions["aux0func"] = tr("Auxilary Function 0");
descriptions["aux1func"] = tr("Auxilary Function 1");
descriptions["aux2func"] = tr("Auxilary Function 2");
descriptions["an0gain"] = tr("Analog 0 Gain");
descriptions["an1gain"] = tr("Analog 1 Gain");
descriptions["an2gain"] = tr("Analog 2 Gain");
descriptions["an3gain"] = tr("Analog 3 Gain");
descriptions["an0off"] = tr("Analog 0 Offset");
descriptions["an1off"] = tr("Analog 1 Offset");
descriptions["an2off"] = tr("Analog 2 Offset");
descriptions["an3off"] = tr("Analog 3 Offset");
descriptions["servoreverse"] = tr("Servo Reverse (BitMask)");
descriptions["magxoff"] = tr("Magnetometer X Calibration Offset");
descriptions["magyoff"] = tr("Magnetometer Y Calibration Offset");
descriptions["magzoff"] = tr("Magnetometer Z Calibration Offset");
descriptions["accxoff"] = tr("Accelerometer X Calibration Offset");
descriptions["accyoff"] = tr("Accelerometer Y Calibration Offset");
descriptions["acczoff"] = tr("Accelerometer Z Calibration Offset");
descriptions["gyrxoff"] = tr("Gyrometer X Calibration Offset");
descriptions["gyryoff"] = tr("Gyrometer Y Calibration Offset");
descriptions["gyrzoff"] = tr("Gyrometer Z Calibration Offset");
descriptions["so00"] = tr("Soft Iron Offset 00");
descriptions["so01"] = tr("Soft Iron Offset 01");
descriptions["so02"] = tr("Soft Iron Offset 02");
descriptions["so10"] = tr("Soft Iron Offset 10");
descriptions["so11"] = tr("Soft Iron Offset 11");
descriptions["so12"] = tr("Soft Iron Offset 12");
descriptions["so20"] = tr("Soft Iron Offset 20");
descriptions["so21"] = tr("Soft Iron Offset 21");
descriptions["so22"] = tr("Soft Iron Offset 22");
descriptions["dismag"] = tr("Disable Magnetometer");
descriptions["rotx"] = tr("Board Rotation X");
descriptions["roty"] = tr("Board Rotation Y");
descriptions["rotz"] = tr("Board Rotation Z");
descriptions["uartmode"] = tr("Uart Mode (0-Off, 1-SBUS, 2-CRSFIN, 3-CRSFOUT)");
descriptions["crsftxrate"] = tr("CRSF Transmit Frequncy");
descriptions["sbustxrate"] = tr("SBUS Transmit Freqency");
descriptions["sbininv"] = tr("SBUS Receieve Inverted");
descriptions["sboutinv"] = tr("SBUS Transmit Inverted");
descriptions["crsftxinv"] = tr("Invert CRSF output");
descriptions["ch5arm"] = tr("Set channel 5 to 2000us");
descriptions["btmode"] = tr("Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, BT_HID_Joystick)");
descriptions["rstonwave"] = tr("Reset on Proximity Sense");
descriptions["butlngps"] = tr("Long Press on the Button to Enable/Disable Tilt Roll and Pan");
descriptions["rstontlt"] = tr("Reset Center on a Head Tilt");
descriptions["rstondblttap"] = tr("Reset on a double tap");
descriptions["rstondbltapthres"] = tr("Double Tap Threshold");
descriptions["rstondbltapmin"] = tr("Double Tap Min Time");
descriptions["rstondbltapmax"] = tr("Double Tap Max Time");
descriptions["ppmoutinvert"] = tr("Invert PPM Output");
descriptions["ppmininvert"] = tr("Invert PPM Output");
descriptions["ppmframe"] = tr("PPM Frame Length (us)");
descriptions["ppmsync"] = tr("PPM Sync Pulse Length (us)");
descriptions["ppmchcnt"] = tr("PPM channels to output");
descriptions["magx"] = tr("Raw Sensor Mag X");
descriptions["magy"] = tr("Raw Sensor Mag Y");
descriptions["magz"] = tr("Raw Sensor Mag Z");
descriptions["gyrox"] = tr("Raw Sensor Gyro X");
descriptions["gyroy"] = tr("Raw Sensor Gyro Y");
descriptions["gyroz"] = tr("Raw Sensor Gyro Z");
descriptions["accx"] = tr("Raw Sensor Accel X");
descriptions["accy"] = tr("Raw Sensor Accel Y");
descriptions["accz"] = tr("Raw Sensor Accel Z");
descriptions["off_magx"] = tr("Calibrated Mag X");
descriptions["off_magy"] = tr("Calibrated Mag Y");
descriptions["off_magz"] = tr("Calibrated Mag Z");
descriptions["off_gyrox"] = tr("Calibrated Gyro X");
descriptions["off_gyroy"] = tr("Calibrated Gyro Y");
descriptions["off_gyroz"] = tr("Calibrated Gyro Z");
descriptions["off_accx"] = tr("Calibrated Accel X");
descriptions["off_accy"] = tr("Calibrated Accel Y");
descriptions["off_accz"] = tr("Calibrated Accel Z");
descriptions["tiltout"] = tr("Board Tilt Output (us)");
descriptions["rollout"] = tr("Board Roll Output (us)");
descriptions["panout"] = tr("Board Pan Output (us)");
descriptions["iscal"] = tr("Has the board been Calibrated");
descriptions["btcon"] = tr("Bluetooth is connected");
descriptions["trpenabled"] = tr("Tilt/Roll/Pan Output Enabled");
descriptions["tilt"] = tr("Raw Tilt in Degrees");
descriptions["roll"] = tr("Raw Roll in Degrees");
descriptions["pan"] = tr("Raw Pan in Degrees");
descriptions["tiltoff"] = tr("Offset Tilt in Degrees");
descriptions["rolloff"] = tr("Offset Roll in Degrees");
descriptions["panoff"] = tr("Offset Pan in Degrees");
descriptions["gyrocal"] = tr("Gyro Has Been Calibrated");
descriptions["btpairedaddress"] = tr("Bluetooth Remote address to Pair With");
descriptions["chout"] = tr("Channel Outputs");
descriptions["btch"] = tr("Bluetooth Inputs");
descriptions["ppmch"] = tr("PPM Inputs");
descriptions["uartch"] = tr("Uart Channels (Sbus/Crsf)");
descriptions["quat"] = tr("Quaternion Output (Tilt / Roll / Pan)");
descriptions["btaddr"] = tr("Local Bluetooth Address");
descriptions["btrmt"] = tr("Remote Bluetooth Address");
_dataItems["chout"] = false;
_dataItems["btch"] = false;
_dataItems["ppmch"] = false;
Expand Down
10 changes: 5 additions & 5 deletions gui/src/calibrateble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ void CalibrateBLE::useMagToggle()
void CalibrateBLE::setButtonText()
{
if(step == 0) {
ui->cmdPrevious->setText("Cancel");
ui->cmdPrevious->setText(tr("Cancel"));
} else {
ui->cmdPrevious->setText("Back");
ui->cmdPrevious->setText(tr("Back"));
}
if(step < STEP_END) {
ui->cmdNext->setText("Next");
ui->cmdNext->setText(tr("Next"));
} else {
ui->cmdNext->setText("Save");
ui->cmdNext->setText(tr("Save"));
}
if(hasMagnetometer == false && step == STEP_ACCELCAL) {
ui->cmdPrevious->setText("Cancel");
ui->cmdPrevious->setText(tr("Cancel"));
}
ui->cmdPrevious->setDisabled(false);
ui->cmdNext->setDisabled(false);
Expand Down
10 changes: 5 additions & 5 deletions gui/src/calibrateble.ui
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
Expand All @@ -268,7 +268,7 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
Expand All @@ -293,7 +293,7 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
Expand All @@ -318,7 +318,7 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -434,7 +434,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
4 changes: 2 additions & 2 deletions gui/src/calibratewizard/calaccelerometer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string notr="true">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down Expand Up @@ -109,7 +109,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string>TextLabel</string>
<string notr="true">TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
8 changes: 4 additions & 4 deletions gui/src/channelviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ChannelViewer::ChannelViewer(TrackerSettings *trk, QWidget *parent) :
staleData = true;
nodataTimer.setInterval(1000);
nodataTimer.start();
setWindowTitle("Channel Viewer");
setWindowTitle(tr("Channel Viewer"));

ui->tabsbusin->setVisible(false);
}
Expand Down Expand Up @@ -218,7 +218,7 @@ void ChannelViewer::addBars()
layoutppmin->addWidget(lblPPMin);
lblPPMin->setVisible(false);
lblPPMin->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
lblPPMin->setText("No PPM Input channels detected");
lblPPMin->setText(tr("No PPM Input channels detected"));

// SBUS Inputs
layoutsbusin = new QVBoxLayout(ui->tabsbusin);
Expand All @@ -237,7 +237,7 @@ void ChannelViewer::addBars()
layoutsbusin->addWidget(lblSBUSin);
lblSBUSin->setVisible(false);
lblSBUSin->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
lblSBUSin->setText("No UART (Sbus/Crsf) input channels detected");
lblSBUSin->setText(tr("No UART (Sbus/Crsf) input channels detected"));

// BT Inputs
layoutbtin = new QVBoxLayout(ui->tabbtin);
Expand All @@ -256,7 +256,7 @@ void ChannelViewer::addBars()
layoutbtin->addWidget(lblBTin);
lblBTin->setVisible(false);
lblBTin->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
lblBTin->setText("No BT Input channels detected");
lblBTin->setText(tr("No BT Input channels detected"));
}

void ChannelViewer::showEvent(QShowEvent *event)
Expand Down
2 changes: 1 addition & 1 deletion gui/src/channelviewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string notr="true">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down
Loading
Loading