Skip to content

Commit

Permalink
Nav: wrap strings (#25089)
Browse files Browse the repository at this point in the history
* Wrap nav strings and translate

* Update QM

* Update QM
  • Loading branch information
sshane authored Jul 9, 2022
1 parent 949de4d commit cbff8fc
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 11 deletions.
22 changes: 11 additions & 11 deletions selfdrive/ui/qt/maps/map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void MapWindow::updateState(const UIState &s) {

loaded_once = loaded_once || m_map->isFullyLoaded();
if (!loaded_once) {
map_instructions->showError("Map Loading");
map_instructions->showError(tr("Map Loading"));
return;
}

Expand All @@ -192,7 +192,7 @@ void MapWindow::updateState(const UIState &s) {
carPosSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature1);
m_map->updateSource("carPosSource", carPosSource);
} else {
map_instructions->showError("Waiting for GPS");
map_instructions->showError(tr("Waiting for GPS"));
}

if (pan_counter == 0) {
Expand Down Expand Up @@ -418,21 +418,21 @@ void MapInstructions::updateDistance(float d) {
if (uiState()->scene.is_metric) {
if (d > 500) {
distance_str.setNum(d / 1000, 'f', 1);
distance_str += " km";
distance_str += tr(" km");
} else {
distance_str.setNum(50 * int(d / 50));
distance_str += " m";
distance_str += tr(" m");
}
} else {
float miles = d * METER_TO_MILE;
float feet = d * METER_TO_FOOT;

if (feet > 500) {
distance_str.setNum(miles, 'f', 1);
distance_str += " mi";
distance_str += tr(" mi");
} else {
distance_str.setNum(50 * int(feet / 50));
distance_str += " ft";
distance_str += tr(" ft");
}
}

Expand Down Expand Up @@ -615,7 +615,7 @@ void MapETA::updateETA(float s, float s_typical, float d) {
auto eta_time = QDateTime::currentDateTime().addSecs(s).time();
if (params.getBool("NavSettingTime24h")) {
eta->setText(eta_time.toString("HH:mm"));
eta_unit->setText("eta");
eta_unit->setText(tr("eta"));
} else {
auto t = eta_time.toString("h:mm a").split(' ');
eta->setText(t[0]);
Expand All @@ -625,11 +625,11 @@ void MapETA::updateETA(float s, float s_typical, float d) {
// Remaining time
if (s < 3600) {
time->setText(QString::number(int(s / 60)));
time_unit->setText("min");
time_unit->setText(tr("min"));
} else {
int hours = int(s) / 3600;
time->setText(QString::number(hours) + ":" + QString::number(int((s - hours * 3600) / 60)).rightJustified(2, '0'));
time_unit->setText("hr");
time_unit->setText(tr("hr"));
}

QString color;
Expand All @@ -649,10 +649,10 @@ void MapETA::updateETA(float s, float s_typical, float d) {
float num = 0;
if (uiState()->scene.is_metric) {
num = d / 1000.0;
distance_unit->setText("km");
distance_unit->setText(tr("km"));
} else {
num = d * METER_TO_MILE;
distance_unit->setText("mi");
distance_unit->setText(tr("mi"));
}

distance_str.setNum(num, 'f', num < 100 ? 1 : 0);
Expand Down
Binary file modified selfdrive/ui/translations/main_ko.qm
Binary file not shown.
64 changes: 64 additions & 0 deletions selfdrive/ui/translations/main_ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,57 @@
<translation>파일갱신: </translation>
</message>
</context>
<context>
<name>MapETA</name>
<message>
<location filename="../qt/maps/map.cc" line="618"/>
<source>eta</source>
<translation>에타</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="628"/>
<source>min</source>
<translation>분</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="632"/>
<source>hr</source>
<translation>시간</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="652"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="655"/>
<source>mi</source>
<translation>mi</translation>
</message>
</context>
<context>
<name>MapInstructions</name>
<message>
<location filename="../qt/maps/map.cc" line="421"/>
<source> km</source>
<translation> km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="424"/>
<source> m</source>
<translation> m</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="432"/>
<source> mi</source>
<translation> mi</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="435"/>
<source> ft</source>
<translation> ft</translation>
</message>
</context>
<context>
<name>MapPanel</name>
<message>
Expand Down Expand Up @@ -389,6 +440,19 @@ location set</source>
<translation>최근 경로 없음</translation>
</message>
</context>
<context>
<name>MapWindow</name>
<message>
<location filename="../qt/maps/map.cc" line="178"/>
<source>Map Loading</source>
<translation>지도 로딩</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="195"/>
<source>Waiting for GPS</source>
<translation>GPS를 기다리는 중</translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
<message>
Expand Down
Binary file modified selfdrive/ui/translations/main_zh-CHS.qm
Binary file not shown.
64 changes: 64 additions & 0 deletions selfdrive/ui/translations/main_zh-CHS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,57 @@
<translation>更新文件: </translation>
</message>
</context>
<context>
<name>MapETA</name>
<message>
<location filename="../qt/maps/map.cc" line="618"/>
<source>eta</source>
<translation>埃塔</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="628"/>
<source>min</source>
<translation>分钟</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="632"/>
<source>hr</source>
<translation>小时</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="652"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="655"/>
<source>mi</source>
<translation>mi</translation>
</message>
</context>
<context>
<name>MapInstructions</name>
<message>
<location filename="../qt/maps/map.cc" line="421"/>
<source> km</source>
<translation> km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="424"/>
<source> m</source>
<translation> m</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="432"/>
<source> mi</source>
<translation> mi</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="435"/>
<source> ft</source>
<translation> ft</translation>
</message>
</context>
<context>
<name>MapPanel</name>
<message>
Expand Down Expand Up @@ -389,6 +440,19 @@ location set</source>
<translation>没有最近的目的地</translation>
</message>
</context>
<context>
<name>MapWindow</name>
<message>
<location filename="../qt/maps/map.cc" line="178"/>
<source>Map Loading</source>
<translation>地图加载</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="195"/>
<source>Waiting for GPS</source>
<translation>等待 GPS</translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
<message>
Expand Down
Binary file modified selfdrive/ui/translations/main_zh-CHT.qm
Binary file not shown.
64 changes: 64 additions & 0 deletions selfdrive/ui/translations/main_zh-CHT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,57 @@
<translation>更新檔案: </translation>
</message>
</context>
<context>
<name>MapETA</name>
<message>
<location filename="../qt/maps/map.cc" line="618"/>
<source>eta</source>
<translation>埃塔</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="628"/>
<source>min</source>
<translation>分鐘</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="632"/>
<source>hr</source>
<translation>小時</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="652"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="655"/>
<source>mi</source>
<translation>mi</translation>
</message>
</context>
<context>
<name>MapInstructions</name>
<message>
<location filename="../qt/maps/map.cc" line="421"/>
<source> km</source>
<translation> km</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="424"/>
<source> m</source>
<translation> m</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="432"/>
<source> mi</source>
<translation> mi</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="435"/>
<source> ft</source>
<translation> ft</translation>
</message>
</context>
<context>
<name>MapPanel</name>
<message>
Expand Down Expand Up @@ -394,6 +445,19 @@ location set</source>
<translation>沒有最近的導航記錄</translation>
</message>
</context>
<context>
<name>MapWindow</name>
<message>
<location filename="../qt/maps/map.cc" line="178"/>
<source>Map Loading</source>
<translation>地圖加載</translation>
</message>
<message>
<location filename="../qt/maps/map.cc" line="195"/>
<source>Waiting for GPS</source>
<translation>等待 GPS</translation>
</message>
</context>
<context>
<name>MultiOptionDialog</name>
<message>
Expand Down

0 comments on commit cbff8fc

Please sign in to comment.