Skip to content

Commit

Permalink
Update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Dec 28, 2019
1 parent 3499582 commit 3f93ff6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 42 deletions.
36 changes: 12 additions & 24 deletions src/Hacs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,45 +100,33 @@ export class Hacs {
if (elapsed < msPerMinute) {
value = Math.round(elapsed / 1000);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(
`time.second${value === 1 ? "" : "s"}`
)} ${this.localize(`time.ago`)}`;
value === 1 ? this.localize(`time.one_second_ago`) : value
} ${this.localize("time.x_seconds_ago", "{x}", String(value))}`;
} else if (elapsed < msPerHour) {
value = Math.round(elapsed / msPerMinute);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(
`time.minute${value === 1 ? "" : "s"}`
)} ${this.localize(`time.ago`)}`;
value === 1 ? this.localize(`time.one_minute_ago`) : value
} ${this.localize("time.x_minutes_ago", "{x}", String(value))}`;
} else if (elapsed < msPerDay) {
value = Math.round(elapsed / msPerHour);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(`time.hour${value === 1 ? "" : "s"}`)} ${this.localize(
`time.ago`
)}`;
value === 1 ? this.localize(`time.one_hour_ago`) : value
} ${this.localize("time.x_hours_ago", "{x}", String(value))}`;
} else if (elapsed < msPerMonth) {
value = Math.round(elapsed / msPerDay);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(`time.day${value === 1 ? "" : "s"}`)} ${this.localize(
`time.ago`
)}`;
value === 1 ? this.localize(`time.one_day_ago`) : value
} ${this.localize("time.x_days_ago", "{x}", String(value))}`;
} else if (elapsed < msPerYear) {
value = Math.round(elapsed / msPerMonth);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(`time.month${value === 1 ? "" : "s"}`)} ${this.localize(
`time.ago`
)}`;
value === 1 ? this.localize(`time.one_month_ago`) : value
} ${this.localize("time.x_months_ago", "{x}", String(value))}`;
} else {
value = Math.round(elapsed / msPerYear);
return `${
value === 1 ? this.localize(`time.one`) : value
} ${this.localize(`time.year${value === 1 ? "" : "s"}`)} ${this.localize(
`time.ago`
)}`;
value === 1 ? this.localize(`time.one_year_ago`) : value
} ${this.localize("time.x_years_ago", "{x}", String(value))}`;
}
}
}
27 changes: 13 additions & 14 deletions src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"downloads": "Downloads",
"flag_this": "Flag this",
"frontend_version": "Frontend version",
"github_stars": "GitHub stars",
"hide_beta": "Hide beta",
"hide": "Hide",
"install": "Install",
Expand Down Expand Up @@ -114,19 +115,17 @@
"status": "Status"
},
"time": {
"ago": "ago",
"day": "day",
"days": "days",
"hour": "hour",
"hours": "hours",
"minute": "minute",
"minutes": "minutes",
"month": "month",
"months": "months",
"one": "One",
"second": "second",
"seconds": "seconds",
"year": "year",
"years": "years"
"one_day_ago": "one day ago",
"one_hour_ago": "one hour ago",
"one_minute_ago": "one minute ago",
"one_month_ago": "one month ago",
"one_second_ago": "one second ago",
"one_year_ago": "one year ago",
"x_days_ago": "{x} days ago",
"x_hours_ago": "{x} hours ago",
"x_minutes_ago": "{x} minutes ago",
"x_months_ago": "{x} months ago",
"x_seconds_ago": "{x} seconds ago",
"x_years_ago": "{x} years ago"
}
}
5 changes: 1 addition & 4 deletions src/panels/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ export class HacsRepository extends LitElement {
${!this.hacs.isnullorempty(this.repo.stars)
? html`
<div class="stars">
<b
>GitHub
${this.hacs.localize(`store.stars`).toLowerCase()}:
</b>
<b>${this.hacs.localize(`repository.github_stars`)}: </b>
${this.repo.stars}
</div>
`
Expand Down

0 comments on commit 3f93ff6

Please sign in to comment.