mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
9915236e42
This PR adds a feature to help admins stay up-to-date with their translations. We already have protections preventing admins from problems when they update their overrides. This change adds some protection in the other direction (where translations change in core due to an upgrade) by creating a notice for admins when defaults have changed. Terms: - In the case where Discourse core changes the default translation, the translation override is considered "outdated". - In the case above where interpolation keys were changed from the ones the override is using, it is considered "invalid". - If none of the above applies, the override is considered "up to date". How does it work? There are a few pieces that makes this work: - When an admin creates or updates a translation override, we store the original translation at the time of write. (This is used to detect changes later on.) - There is a background job that runs once every day and checks for outdated and invalid overrides, and marks them as such. - When there are any outdated or invalid overrides, a notice is shown in admin dashboard with a link to the text customization page. Known limitations The link from the dashboard links to the default locale text customization page. Given there might be invalid overrides in multiple languages, I'm not sure what we could do here. Consideration for future improvement.
74 lines
1.8 KiB
Handlebars
74 lines
1.8 KiB
Handlebars
<div class="search-area">
|
|
<p>{{i18n "admin.site_text.description"}}</p>
|
|
|
|
<TextField
|
|
@value={{this.q}}
|
|
@placeholderKey="admin.site_text.search"
|
|
@class="no-blur site-text-search"
|
|
@autofocus="true"
|
|
@key-up={{action "search"}}
|
|
/>
|
|
|
|
<div class="reseed">
|
|
<DButton
|
|
@action={{route-action "showReseedModal"}}
|
|
@class="btn-default"
|
|
@label="admin.reseed.action.label"
|
|
@title="admin.reseed.action.title"
|
|
@icon="sync"
|
|
/>
|
|
</div>
|
|
|
|
<p class="filter-options">
|
|
<div class="locale">
|
|
<label>{{i18n "admin.site_text.locale"}}</label>
|
|
<ComboBox
|
|
@valueProperty="value"
|
|
@content={{this.availableLocales}}
|
|
@value={{this.locale}}
|
|
@onChange={{action "updateLocale"}}
|
|
@class="locale-search"
|
|
@options={{hash filterable=true}}
|
|
/>
|
|
</div>
|
|
|
|
<label>
|
|
<Input
|
|
id="toggle-overridden"
|
|
@type="checkbox"
|
|
@checked={{this.overridden}}
|
|
{{on "click" (action "toggleOverridden")}}
|
|
/>
|
|
{{i18n "admin.site_text.show_overriden"}}
|
|
</label>
|
|
|
|
<label>
|
|
<Input
|
|
id="toggle-outdated"
|
|
@type="checkbox"
|
|
@checked={{this.outdated}}
|
|
{{on "click" this.toggleOutdated}}
|
|
/>
|
|
{{i18n "admin.site_text.show_outdated"}}
|
|
</label>
|
|
</p>
|
|
</div>
|
|
|
|
<ConditionalLoadingSpinner @condition={{this.searching}}>
|
|
{{#if this.siteTexts.extras.recommended}}
|
|
<p><b>{{i18n "admin.site_text.recommended"}}</b></p>
|
|
{{/if}}
|
|
|
|
{{#each this.siteTexts as |siteText|}}
|
|
<SiteTextSummary
|
|
@siteText={{siteText}}
|
|
@editAction={{action "edit"}}
|
|
@term={{this.q}}
|
|
@searchRegex={{this.siteTexts.extras.regex}}
|
|
/>
|
|
{{/each}}
|
|
|
|
{{#if this.siteTexts.extras.has_more}}
|
|
<p class="warning">{{i18n "admin.site_text.more_than_50_results"}}</p>
|
|
{{/if}}
|
|
</ConditionalLoadingSpinner> |