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

Update TrackAnalysis.js #836

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
11 changes: 7 additions & 4 deletions js/control/TrackAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ BR.TrackAnalysis = L.Class.extend({
let trackType = '';
if (highwayType === 'track') {
trackType = this.getTrackType(wayTags);
highwayType = 'Track ' + trackType;
highwayType = i18next.t(
'sidebar.analysis.data.highway.' + highwayType,
highwayType
) + ' ' + trackType;
}
if (typeof analysis.highway[highwayType] === 'undefined') {
analysis.highway[highwayType] = {
Expand Down Expand Up @@ -414,7 +417,7 @@ BR.TrackAnalysis = L.Class.extend({
data-subtype="${data[index].subtype}" \
data-distance="${data[index].distance}"></tr>`);
$row.append(`<td class="track-analysis-title">${data[index].formatted_name}</td>`);
$row.append(`<td class="track-analysis-distance">${this.formatDistance(data[index].distance)} km</td>`);
$row.append(`<td class="track-analysis-distance">${this.formatDistance(data[index].distance)} ${i18next.t('footer.kilometer-abbrev')}</td>`);
$tbody.append($row);
totalDistance += data[index].distance;
}
Expand All @@ -427,7 +430,7 @@ BR.TrackAnalysis = L.Class.extend({
$(
`<td class="track-analysis-distance">${this.formatDistance(
this.totalRouteDistance - totalDistance
)} km</td>`
)} ${i18next.t('footer.kilometer-abbrev')}</td>`
)
)
);
Expand All @@ -443,7 +446,7 @@ BR.TrackAnalysis = L.Class.extend({
$(
`<td class="track-analysis-distance track-analysis-distance-total">${this.formatDistance(
totalDistance
)} km</td>`
)} ${i18next.t('footer.kilometer-abbrev')}</td>`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR! If you are done, do not forget to:

  1. add dynamic i18n keys in locales/keys.js
  2. run gulp i18next to regenerate English translations
  3. I'll push the new content to Transifex then.

)
)
);
Expand Down