DEV: I18n all the things

This commit is contained in:
Jarek Radosz 2023-01-24 20:49:13 +01:00
parent f9f5f5d1ff
commit 17f726e853
8 changed files with 67 additions and 45 deletions

View File

@ -19,22 +19,22 @@
<td>
{{#if @repo.checkingStatus}}
Checking for new version...
{{i18n "admin.docker.checking"}}
{{else if @repo.upToDate}}
Up to date
{{i18n "admin.docker.up_to_date"}}
{{else}}
<div class="new-version">
<h4>New Version Available!</h4>
<h4>{{i18n "admin.docker.new_version_available"}}</h4>
<ul>
<li>
Remote Version:
{{i18n "admin.docker.latest_version"}}
<span class="new commit-hash" title={{@repo.latestVersion}}>
{{@repo.prettyLatestVersion}}
</span>
</li>
<li>
Last Updated:
{{i18n "admin.docker.last_updated"}}
{{#if @repo.latest.date}}
{{format-date @repo.latest.date}}
{{else}}

View File

@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import I18n from "I18n";
export default class RepoStatus extends Component {
@service router;
@ -30,17 +31,17 @@ export default class RepoStatus extends Component {
get officialRepoBadgeTitle() {
if (this.args.repo.fork) {
return "Forked Official Plugin";
return I18n.t("admin.docker.forked_plugin");
} else if (this.args.repo.official) {
return "Official Plugin";
return I18n.t("admin.docker.official_plugin");
}
}
get upgradeButtonLabel() {
if (this.args.repo.upgrading) {
return "Currently Upgrading…";
return I18n.t("admin.docker.upgrading");
} else {
return "Upgrade";
return I18n.t("admin.docker.upgrade_action");
}
}

View File

@ -1,12 +1,13 @@
{{#if this.currentUser.admin}}
{{#if @versionCheck.upToDate}}
<LinkTo @route="upgrade">
{{i18n "docker.link_to_upgrade"}}
{{i18n "admin.docker.link_to_upgrade"}}
</LinkTo>
{{else}}
{{i18n "docker.upgrade"}}
{{i18n "admin.docker.outdated_notice"}}
<LinkTo @route="upgrade">
{{i18n "docker.perform_upgrade"}}
{{i18n "admin.docker.perform_upgrade"}}
</LinkTo>
{{/if}}
{{/if}}

View File

@ -4,6 +4,7 @@ import { inject as service } from "@ember/service";
import { tracked } from "@glimmer/tracking";
import { equal } from "@ember/object/computed";
import { action } from "@ember/object";
import I18n from "I18n";
export default class UpgradeShow extends Controller {
@service messageBus;
@ -36,14 +37,6 @@ export default class UpgradeShow extends Controller {
return this.isMultiple ? this.model : [this.model];
}
get upgradeButtonText() {
if (this.upgrading) {
return "Upgrading...";
} else {
return "Start Upgrading";
}
}
updateAttribute(key, value, valueIsKey = false) {
this.model.forEach((repo) => {
value = valueIsKey ? repo[value] : value;
@ -116,10 +109,7 @@ export default class UpgradeShow extends Controller {
@action
resetUpgrade() {
const message = `
WARNING: You should only reset upgrades that have failed and are not running.
This will NOT cancel currently running builds and should only be used as a last resort.
`;
const message = I18n.t("admin.docker.reset_warning");
this.dialog.confirm({
message,

View File

@ -1,5 +1,6 @@
import { helper as buildHelper } from "@ember/component/helper";
import { htmlSafe } from "@ember/template";
import I18n from "I18n";
export default buildHelper(function (params) {
const [commitsBehind, oldSha, newSha, url] = params;
@ -12,9 +13,9 @@ export default buildHelper(function (params) {
return "";
}
let description = `${commitsBehind} new commit${
commitsBehind === 1 ? "" : "s"
}`;
let description = I18n.t("admin.docker.commits", {
count: commitsBehind,
});
if (!url) {
return description;

View File

@ -1,4 +1,4 @@
<h1>Upgrade</h1>
<h1>{{i18n "admin.docker.upgrade_title"}}</h1>
<button
disabled={{upgradeAllButtonDisabled}}
@ -7,17 +7,17 @@
{{action "upgradeAllButton"}}
>
{{#if allUpToDate}}
All Up-to-date
{{i18n "admin.docker.all_up_to_date"}}
{{else}}
Upgrade All
{{i18n "admin.docker.upgrade_all"}}
{{/if}}
</button>
<table class="table" id="repos">
<thead>
<th></th>
<th style="width: 50%">Repository</th>
<th>Status</th>
<th style="width: 50%">{{i18n "admin.docker.repository"}}</th>
<th>{{i18n "admin.docker.status"}}</th>
</thead>
<tbody>
{{#each this.model as |repo|}}

View File

@ -1,27 +1,31 @@
<h3>Upgrade {{this.title}}</h3>
<h3>{{i18n "admin.docker.upgrade_repo" name=this.title}}</h3>
<ProgressBar @percent={{this.percent}} />
{{#if this.complete}}
<p>Upgrade completed successfully!</p>
<p>{{i18n "admin.docker.upgrade_successful"}}</p>
{{else if this.failed}}
<p>Sorry, there was an error upgrading Discourse. Please check the logs below.</p>
<p>{{i18n "admin.docker.upgrade_error"}}</p>
{{/if}}
{{#if this.isUpToDate}}
{{#unless this.multiUpgrade}}
<p>{{this.title}} is at the newest version.</p>
<p>{{i18n "admin.docker.repo_newest_version" name=this.title}}</p>
{{else}}
<p>Everything is up-to-date.</p>
<p>{{i18n "admin.docker.everything_up_to_date"}}</p>
{{/unless}}
{{else}}
<button {{on "click" this.start}} disabled={{this.upgrading}} class="btn">
{{upgradeButtonText}}
{{#if this.upgrading}}
{{i18n "admin.docker.upgrading"}}
{{else}}
{{i18n "admin.docker.start_upgrading"}}
{{/if}}
</button>
{{#if this.upgrading}}
<button {{on "click" this.resetUpgrade}} class="btn unlock">
Reset Upgrade
{{i18n "admin.docker.reset_upgrade"}}
</button>
{{/if}}
{{/if}}

View File

@ -1,12 +1,37 @@
en:
js:
admin:
docker:
all_up_to_date: "All Up-to-date"
checking: "Checking for new version…"
commits:
one: "%{count} new commit"
other: "%{count} new commits"
everything_up_to_date: "Everything is up-to-date"
forked_plugin: "Forked Official Plugin"
last_updated: "Last Updated:"
latest_version: "Latest Version:"
link_to_upgrade: "Perform upgrades here"
new_version_available: "New Version Available!"
official_plugin: "Official Plugin"
outdated_notice: "Your Discourse installation is out of date"
perform_upgrade: "Click here to upgrade."
repo_newest_version: "%{name} is at the newest version."
repository: "Repository"
reset_upgrade: "Reset Upgrade"
reset_warning: "WARNING: You should only reset upgrades that have failed and are not running. This will NOT cancel currently running builds and should only be used as a last resort."
start_upgrading: "Start Upgrading"
status: "Status"
up_to_date: "Up to date"
upgrade_action: "Upgrade"
upgrade_all: "Upgrade All"
upgrade_error: "Sorry, there was an error upgrading Discourse. Please check the logs below."
upgrade_repo: "Upgrade %{name}"
upgrade_successful: "Upgrade completed successfully!"
upgrade_title: "Upgrade"
upgrading: "Upgrading…"
logs:
staff_actions:
actions:
discourse_upgrade: "Upgrade to the Latest Version"
docker:
upgrade: "Your Discourse installation is out of date."
perform_upgrade: "Click here to upgrade."
link_to_upgrade: "Perform upgrades here."
discourse_upgrade: "Upgrade to the latest version"