diff --git a/selfdrive/ui/qt/offroad/networking.cc b/selfdrive/ui/qt/offroad/networking.cc index 536ca495ca..c7341d1987 100644 --- a/selfdrive/ui/qt/offroad/networking.cc +++ b/selfdrive/ui/qt/offroad/networking.cc @@ -84,7 +84,7 @@ void Networking::connectToNetwork(const Network &n) { } else if (n.security_type == SecurityType::OPEN) { wifi->connect(n); } else if (n.security_type == SecurityType::WPA) { - QString pass = InputDialog::getText(tr("Enter password"), this, tr("for \"") + n.ssid + "\"", true, 8); + QString pass = InputDialog::getText(tr("Enter password"), this, tr("for \"%1\"").arg(QString::fromUtf8(n.ssid)), true, 8); if (!pass.isEmpty()) { wifi->connect(n, pass); } @@ -94,7 +94,7 @@ void Networking::connectToNetwork(const Network &n) { void Networking::wrongPassword(const QString &ssid) { if (wifi->seenNetworks.contains(ssid)) { const Network &n = wifi->seenNetworks.value(ssid); - QString pass = InputDialog::getText(tr("Wrong password"), this, tr("for \"") + n.ssid +"\"", true, 8); + QString pass = InputDialog::getText(tr("Wrong password"), this, tr("for \"%1\"").arg(QString::fromUtf8(n.ssid)), true, 8); if (!pass.isEmpty()) { wifi->connect(n, pass); } @@ -174,7 +174,7 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid list->addItem(editApnButton); // Set initial config - wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn"))); + wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn"))); main_layout->addWidget(new ScrollView(list, this)); main_layout->addStretch(1); @@ -296,7 +296,7 @@ void WifiUI::refresh() { QPushButton *forgetBtn = new QPushButton(tr("FORGET")); forgetBtn->setObjectName("forgetBtn"); QObject::connect(forgetBtn, &QPushButton::clicked, [=]() { - if (ConfirmationDialog::confirm(tr("Forget Wi-Fi Network \"") + QString::fromUtf8(network.ssid) + "\"?", this)) { + if (ConfirmationDialog::confirm(tr("Forget Wi-Fi Network \"%1\"?").arg(QString::fromUtf8(network.ssid)), this)) { wifi->forgetConnection(network.ssid); } }); diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 9aeb966ccf..9a6e203966 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -249,7 +249,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { }); - auto uninstallBtn = new ButtonControl(tr("Uninstall ") + getBrand(), tr("UNINSTALL")); + auto uninstallBtn = new ButtonControl(tr("Uninstall %1").arg(getBrand()), tr("UNINSTALL")); connect(uninstallBtn, &ButtonControl::clicked, [&]() { if (ConfirmationDialog::confirm(tr("Are you sure you want to uninstall?"), this)) { params.putBool("DoUninstall", true); diff --git a/selfdrive/ui/qt/widgets/input.cc b/selfdrive/ui/qt/widgets/input.cc index b0facfce83..dc54a3621c 100644 --- a/selfdrive/ui/qt/widgets/input.cc +++ b/selfdrive/ui/qt/widgets/input.cc @@ -165,7 +165,7 @@ void InputDialog::handleEnter() { done(QDialog::Accepted); emitText(line->text()); } else { - setMessage(tr("Need at least ") + QString::number(minLength) + tr(" characters!"), false); + setMessage(tr("Need at least %1 characters!").arg(minLength), false); } } diff --git a/selfdrive/ui/qt/widgets/prime.cc b/selfdrive/ui/qt/widgets/prime.cc index d2529821f4..5419475262 100644 --- a/selfdrive/ui/qt/widgets/prime.cc +++ b/selfdrive/ui/qt/widgets/prime.cc @@ -88,13 +88,16 @@ PairingPopup::PairingPopup(QWidget *parent) : QDialogBase(parent) { title->setWordWrap(true); vlayout->addWidget(title); - QLabel *instructions = new QLabel(tr(R"( + QLabel *instructions = new QLabel(QString(R"(
    -
  1. Go to https://connect.comma.ai on your phone
  2. -
  3. Click "add new device" and scan the QR code on the right
  4. -
  5. Bookmark connect.comma.ai to your home screen to use it like an app
  6. +
  7. %1
  8. +
  9. %2
  10. +
  11. %3
- )"), this); + )").arg(tr("Go to https://connect.comma.ai on your phone")) + .arg(tr("Click \"add new device\" and scan the QR code on the right")) + .arg(tr("Bookmark connect.comma.ai to your home screen to use it like an app")), this); + instructions->setStyleSheet("font-size: 47px; font-weight: bold; color: black;"); instructions->setWordWrap(true); vlayout->addWidget(instructions); diff --git a/selfdrive/ui/translations/main_ko.qm b/selfdrive/ui/translations/main_ko.qm index 4c8b030327..4ba8cc0094 100644 --- a/selfdrive/ui/translations/main_ko.qm +++ b/selfdrive/ui/translations/main_ko.qm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e2338f5e74f7be0ef00229b0f30e3129dcd1eaa3f06b0f9ede3c2dc89a743d1 -size 19981 +oid sha256:fb7e26c65d5dee24c17532f9810a00e6a278f6f8f851bdd06418e4ed13fed213 +size 19439 diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 3805f0e3ff..2fefa69a80 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -308,13 +308,8 @@ - Need at least - 최소 - - - - characters! - 자가 필요합니다! + Need at least %1 characters! + 최소 %1 자가 필요합니다! @@ -481,8 +476,8 @@ location set - for " - 하기위한 " + for "%1" + 하기위한 "%1" @@ -547,52 +542,50 @@ location set 장치를 콤마 계정과 페어링합니다 - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>Go to https://connect.comma.ai on your phone</li> - <li style='margin-bottom: 50px;'>Click "add new device" and scan the QR code on the right</li> - <li style='margin-bottom: 50px;'>Bookmark connect.comma.ai to your home screen to use it like an app</li> - </ol> - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>https://connect.comma.ai에 접속하세요</li> - <li style='margin-bottom: 50px;'>"새 장치 추가"를 클릭하고 오른쪽 QR 코드를 검색합니다.</li> - <li style='margin-bottom: 50px;'>connect.comma.ai을 앱처럼 사용하려면 홈 화면에 바로가기를 만드십시오.</li> - </ol> - + + Go to https://connect.comma.ai on your phone + https://connect.comma.ai에 접속하세요 + + + + Click "add new device" and scan the QR code on the right + "새 장치 추가"를 클릭하고 오른쪽 QR 코드를 검색합니다 + + + + Bookmark connect.comma.ai to your home screen to use it like an app + connect.comma.ai을 앱처럼 사용하려면 홈 화면에 바로가기를 만드십시오 PrimeAdWidget - + Upgrade Now 지금 업그레이드 - + Become a comma prime member at connect.comma.ai connect.comma.ai에서 comma prime에 가입합니다 - + PRIME FEATURES: PRIME 기능: - + Remote access 원격 접속 - + 1 year of storage 1년간 저장 - + Developer perks 개발자 혜택 @@ -600,22 +593,22 @@ location set PrimeUserWidget - + ✓ SUBSCRIBED ✓ 구독함 - + comma prime comma prime - + CONNECT.COMMA.AI CONNECT.COMMA.AI - + COMMA POINTS COMMA POINTS @@ -857,17 +850,17 @@ location set SetupWidget - + Finish Setup 설정 완료 - + Pair your device with comma connect (connect.comma.ai) and claim your comma prime offer. 장치를 (connect.comma.ai)에서 페어링하고 comma prime 오퍼를 청구합니다. - + Pair device 장치 페어링 @@ -1023,13 +1016,13 @@ location set - Uninstall - 제거 + UNINSTALL + 제거 - UNINSTALL - 제거 + Uninstall %1 + 제거 %1 @@ -1274,8 +1267,8 @@ location set - Forget Wi-Fi Network " - wifi 네트워크 저장안함 " + Forget Wi-Fi Network "%1"? + wifi 네트워크 저장안함 "%1"? diff --git a/selfdrive/ui/translations/main_zh-CHS.qm b/selfdrive/ui/translations/main_zh-CHS.qm index 8b4a5f55f2..2976aa478b 100644 --- a/selfdrive/ui/translations/main_zh-CHS.qm +++ b/selfdrive/ui/translations/main_zh-CHS.qm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e042d706f1886874e0189b0542d4455050b59b6958e79ae03b563e35106e2be -size 18469 +oid sha256:ddfc47a6fec5375c88f63275d02846cb7f4bf5431346cad895038a8705724ba3 +size 17931 diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index d9377054a5..0870ff7028 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -308,13 +308,8 @@ - Need at least - 至少需要 - - - - characters! - 个字符! + Need at least %1 characters! + 至少需要 %1 个字符! @@ -479,8 +474,8 @@ location set - for " - 网络名称:" + for "%1" + 网络名称:"%1" @@ -545,52 +540,50 @@ location set 将您的设备与comma账号配对 - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>Go to https://connect.comma.ai on your phone</li> - <li style='margin-bottom: 50px;'>Click "add new device" and scan the QR code on the right</li> - <li style='margin-bottom: 50px;'>Bookmark connect.comma.ai to your home screen to use it like an app</li> - </ol> - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>在手机上访问 https://connect.comma.ai</li> - <li style='margin-bottom: 50px;'>点击“添加新设备”,扫描右侧二维码</li> - <li style='margin-bottom: 50px;'>将 connect.comma.ai 收藏到您的主屏幕,以便像应用程序一样使用它</li> - </ol> - + + Go to https://connect.comma.ai on your phone + 在手机上访问 https://connect.comma.ai + + + + Click "add new device" and scan the QR code on the right + 点击“添加新设备”,扫描右侧二维码 + + + + Bookmark connect.comma.ai to your home screen to use it like an app + 将 connect.comma.ai 收藏到您的主屏幕,以便像应用程序一样使用它 PrimeAdWidget - + Upgrade Now 现在升级 - + Become a comma prime member at connect.comma.ai 打开connect.comma.ai以注册comma prime会员 - + PRIME FEATURES: comma prime特权: - + Remote access 远程访问 - + 1 year of storage 1年数据存储 - + Developer perks 开发者福利 @@ -598,22 +591,22 @@ location set PrimeUserWidget - + ✓ SUBSCRIBED ✓ 已订阅 - + comma prime comma prime - + CONNECT.COMMA.AI CONNECT.COMMA.AI - + COMMA POINTS COMMA POINTS点数 @@ -855,17 +848,17 @@ location set SetupWidget - + Finish Setup 完成设置 - + Pair your device with comma connect (connect.comma.ai) and claim your comma prime offer. 将您的设备与comma connect (connect.comma.ai)配对并领取您的comma prime优惠。 - + Pair device 配对设备 @@ -1021,13 +1014,13 @@ location set - Uninstall - 卸载 + UNINSTALL + 卸载 - UNINSTALL - 卸载 + Uninstall %1 + 卸载 %1 @@ -1272,8 +1265,8 @@ location set - Forget Wi-Fi Network " - 忘记WiFi网络" + Forget Wi-Fi Network "%1"? + 忘记WiFi网络 "%1"? diff --git a/selfdrive/ui/translations/main_zh-CHT.qm b/selfdrive/ui/translations/main_zh-CHT.qm index 0d71e0e187..b2b8f151a0 100644 --- a/selfdrive/ui/translations/main_zh-CHT.qm +++ b/selfdrive/ui/translations/main_zh-CHT.qm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:953e9b3373d9120e66da108eec0cb9689f7b2646229d4ea7c05e7b31392acbb2 -size 18509 +oid sha256:846dcae2af3d8071cdcfd1a20a65e06b7e7105cb128bae8b8244f2a29fe59dc4 +size 17969 diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index efd893ec4c..0620382a63 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -308,13 +308,8 @@ - Need at least - 需要至少 - - - - characters! - 個字元! + Need at least %1 characters! + 需要至少 %1 個字元! @@ -481,8 +476,8 @@ location set - for " - 給 " + for "%1" + 給 "%1" @@ -547,52 +542,50 @@ location set 將設備與您的 comma 帳號配對 - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>Go to https://connect.comma.ai on your phone</li> - <li style='margin-bottom: 50px;'>Click "add new device" and scan the QR code on the right</li> - <li style='margin-bottom: 50px;'>Bookmark connect.comma.ai to your home screen to use it like an app</li> - </ol> - - - <ol type='1' style='margin-left: 15px;'> - <li style='margin-bottom: 50px;'>用手機連至 https://connect.comma.ai</li> - <li style='margin-bottom: 50px;'>點選 "add new device" 後掃描右邊的二維碼</li> - <li style='margin-bottom: 50px;'>將 connect.comma.ai 加入您的主屏幕,以便像手機 App 一樣使用它</li> - </ol> - + + Go to https://connect.comma.ai on your phone + 用手機連至 https://connect.comma.ai + + + + Click "add new device" and scan the QR code on the right + 點選 "add new device" 後掃描右邊的二維碼 + + + + Bookmark connect.comma.ai to your home screen to use it like an app + 將 connect.comma.ai 加入您的主屏幕,以便像手機 App 一樣使用它 PrimeAdWidget - + Upgrade Now 馬上升級 - + Become a comma prime member at connect.comma.ai 成為 connect.comma.ai 的高級會員 - + PRIME FEATURES: 高級會員特點: - + Remote access 遠程訪問 - + 1 year of storage 一年的雲端行車記錄 - + Developer perks 開發者福利 @@ -600,22 +593,22 @@ location set PrimeUserWidget - + ✓ SUBSCRIBED ✓ 已訂閱 - + comma prime comma 高級會員 - + CONNECT.COMMA.AI CONNECT.COMMA.AI - + COMMA POINTS COMMA 積分 @@ -860,17 +853,17 @@ location set SetupWidget - + Finish Setup 完成設置 - + Pair your device with comma connect (connect.comma.ai) and claim your comma prime offer. 將您的設備與 comma connect (connect.comma.ai) 配對並領取您的 comma 高級會員優惠。 - + Pair device 配對設備 @@ -1026,13 +1019,13 @@ location set - Uninstall - 卸載 + UNINSTALL + 卸載 - UNINSTALL - 卸載 + Uninstall %1 + 卸載 %1 @@ -1277,8 +1270,8 @@ location set - Forget Wi-Fi Network " - 清除 Wi-Fi 網路 " + Forget Wi-Fi Network "%1"? + 清除 Wi-Fi 網路 "%1"? diff --git a/selfdrive/ui/update_translations.py b/selfdrive/ui/update_translations.py index d872be0d86..f06d54b2d5 100755 --- a/selfdrive/ui/update_translations.py +++ b/selfdrive/ui/update_translations.py @@ -10,7 +10,7 @@ TRANSLATIONS_DIR = os.path.join(UI_DIR, "translations") LANGUAGES_FILE = os.path.join(TRANSLATIONS_DIR, "languages.json") -def update_translations(release=False, translations_dir=TRANSLATIONS_DIR): +def update_translations(release=False, vanish=False, translations_dir=TRANSLATIONS_DIR): with open(LANGUAGES_FILE, "r") as f: translation_files = json.load(f) @@ -20,7 +20,10 @@ def update_translations(release=False, translations_dir=TRANSLATIONS_DIR): continue tr_file = os.path.join(translations_dir, f"{file}.ts") - ret = os.system(f"lupdate -recursive {UI_DIR} -ts {tr_file}") + args = f"lupdate -recursive {UI_DIR} -ts {tr_file}" + if vanish: + args += " -no-obsolete" + ret = os.system(args) assert ret == 0 if release: @@ -32,6 +35,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Update translation files for UI", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("--release", action="store_true", help="Create compiled QM translation files used by UI") + parser.add_argument("--vanish", action="store_true", help="Remove translations with source text no longer found") args = parser.parse_args() - update_translations(args.release) + update_translations(args.release, args.vanish)