From 3f93ff6e540c5f4f278226fc09300065518909a2 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sat, 28 Dec 2019 12:56:31 +0000 Subject: [PATCH] Update translations --- src/Hacs.ts | 36 ++++++++++++---------------------- src/localize/languages/en.json | 27 ++++++++++++------------- src/panels/repository.ts | 5 +---- 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/Hacs.ts b/src/Hacs.ts index bf8f073c0..e43511f3c 100644 --- a/src/Hacs.ts +++ b/src/Hacs.ts @@ -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))}`; } } } diff --git a/src/localize/languages/en.json b/src/localize/languages/en.json index 14b4cac5e..2a6edd1dd 100644 --- a/src/localize/languages/en.json +++ b/src/localize/languages/en.json @@ -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", @@ -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" } } diff --git a/src/panels/repository.ts b/src/panels/repository.ts index c9b445459..d22da39bd 100644 --- a/src/panels/repository.ts +++ b/src/panels/repository.ts @@ -121,10 +121,7 @@ export class HacsRepository extends LitElement { ${!this.hacs.isnullorempty(this.repo.stars) ? html`
- GitHub - ${this.hacs.localize(`store.stars`).toLowerCase()}: - + ${this.hacs.localize(`repository.github_stars`)}: ${this.repo.stars}
`