mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 20:12:07 +08:00
ui: multilang date (#25741)
* multilang date * update translations * add language to uistate * update translations * use it here too Co-authored-by: sshane <shane@smiskol.com> old-commit-hash: 27e1ec8fd31192696cef70e4c6a98cbe7c3ba15a
This commit is contained in:
@@ -183,7 +183,9 @@ void OffroadHome::hideEvent(QHideEvent *event) {
|
||||
}
|
||||
|
||||
void OffroadHome::refresh() {
|
||||
date->setText(QDateTime::currentDateTime().toString("dddd, MMMM d"));
|
||||
QString locale_name = QString(uiState()->language).replace("main_", "");
|
||||
QString dateString = QLocale(locale_name).toString(QDateTime::currentDateTime(), "dddd, MMMM d");
|
||||
date->setText(dateString);
|
||||
|
||||
bool updateAvailable = update_widget->refresh();
|
||||
int alerts = alerts_widget->refresh();
|
||||
|
||||
@@ -189,8 +189,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
auto translateBtn = new ButtonControl(tr("Change Language"), tr("CHANGE"), "");
|
||||
connect(translateBtn, &ButtonControl::clicked, [=]() {
|
||||
QMap<QString, QString> langs = getSupportedLanguages();
|
||||
QString currentLang = QString::fromStdString(Params().get("LanguageSetting"));
|
||||
QString selection = MultiOptionDialog::getSelection(tr("Select a language"), langs.keys(), langs.key(currentLang), this);
|
||||
QString selection = MultiOptionDialog::getSelection(tr("Select a language"), langs.keys(), langs.key(uiState()->language), this);
|
||||
if (!selection.isEmpty()) {
|
||||
// put language setting, exit Qt UI, and trigger fast restart
|
||||
Params().put("LanguageSetting", langs[selection].toStdString());
|
||||
|
||||
@@ -526,7 +526,7 @@ location set</source>
|
||||
<translation>更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+91"/>
|
||||
<location line="+93"/>
|
||||
<source> ALERTS</source>
|
||||
<translation> 警告</translation>
|
||||
</message>
|
||||
@@ -539,7 +539,7 @@ location set</source>
|
||||
<context>
|
||||
<name>PairingPopup</name>
|
||||
<message>
|
||||
<location filename="../qt/widgets/prime.cc" line="+86"/>
|
||||
<location filename="../qt/widgets/prime.cc" line="+89"/>
|
||||
<source>Pair your device to your comma account</source>
|
||||
<translation>デバイスと comma アカウントを連携する</translation>
|
||||
</message>
|
||||
|
||||
@@ -526,7 +526,7 @@ location set</source>
|
||||
<translation>업데이트</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+91"/>
|
||||
<location line="+93"/>
|
||||
<source> ALERTS</source>
|
||||
<translation> 알림</translation>
|
||||
</message>
|
||||
@@ -539,7 +539,7 @@ location set</source>
|
||||
<context>
|
||||
<name>PairingPopup</name>
|
||||
<message>
|
||||
<location filename="../qt/widgets/prime.cc" line="+86"/>
|
||||
<location filename="../qt/widgets/prime.cc" line="+89"/>
|
||||
<source>Pair your device to your comma account</source>
|
||||
<translation>장치를 콤마 계정과 페어링합니다</translation>
|
||||
</message>
|
||||
|
||||
@@ -527,7 +527,7 @@ trabalho definido</translation>
|
||||
<translation>ATUALIZAÇÃO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+91"/>
|
||||
<location line="+93"/>
|
||||
<source> ALERTS</source>
|
||||
<translation> ALERTAS</translation>
|
||||
</message>
|
||||
@@ -540,7 +540,7 @@ trabalho definido</translation>
|
||||
<context>
|
||||
<name>PairingPopup</name>
|
||||
<message>
|
||||
<location filename="../qt/widgets/prime.cc" line="+86"/>
|
||||
<location filename="../qt/widgets/prime.cc" line="+89"/>
|
||||
<source>Pair your device to your comma account</source>
|
||||
<translation>Pareie seu dispositivo à sua conta comma</translation>
|
||||
</message>
|
||||
|
||||
@@ -524,7 +524,7 @@ location set</source>
|
||||
<translation>更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+91"/>
|
||||
<location line="+93"/>
|
||||
<source> ALERTS</source>
|
||||
<translation> 警报</translation>
|
||||
</message>
|
||||
@@ -537,7 +537,7 @@ location set</source>
|
||||
<context>
|
||||
<name>PairingPopup</name>
|
||||
<message>
|
||||
<location filename="../qt/widgets/prime.cc" line="+86"/>
|
||||
<location filename="../qt/widgets/prime.cc" line="+89"/>
|
||||
<source>Pair your device to your comma account</source>
|
||||
<translation>将您的设备与comma账号配对</translation>
|
||||
</message>
|
||||
|
||||
@@ -526,7 +526,7 @@ location set</source>
|
||||
<translation>更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+91"/>
|
||||
<location line="+93"/>
|
||||
<source> ALERTS</source>
|
||||
<translation> 提醒</translation>
|
||||
</message>
|
||||
@@ -539,7 +539,7 @@ location set</source>
|
||||
<context>
|
||||
<name>PairingPopup</name>
|
||||
<message>
|
||||
<location filename="../qt/widgets/prime.cc" line="+86"/>
|
||||
<location filename="../qt/widgets/prime.cc" line="+89"/>
|
||||
<source>Pair your device to your comma account</source>
|
||||
<translation>將設備與您的 comma 帳號配對</translation>
|
||||
</message>
|
||||
|
||||
@@ -236,6 +236,7 @@ UIState::UIState(QObject *parent) : QObject(parent) {
|
||||
Params params;
|
||||
wide_camera = params.getBool("WideCameraOnly");
|
||||
prime_type = std::atoi(params.get("PrimeType").c_str());
|
||||
language = QString::fromStdString(params.get("LanguageSetting"));
|
||||
|
||||
// update timer
|
||||
timer = new QTimer(this);
|
||||
|
||||
@@ -127,6 +127,7 @@ public:
|
||||
|
||||
bool awake;
|
||||
int prime_type = 0;
|
||||
QString language;
|
||||
|
||||
QTransform car_space_transform;
|
||||
bool wide_camera;
|
||||
|
||||
Reference in New Issue
Block a user