mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 18:03:42 +08:00
ea8b5c18db
Admins can now edit translations in different languages without having to change their locale. We display a warning when there's a fallback language set.
31 lines
737 B
JavaScript
31 lines
737 B
JavaScript
import Route from "@ember/routing/route";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
export default Route.extend({
|
|
queryParams: {
|
|
locale: { replace: true },
|
|
},
|
|
|
|
model(params) {
|
|
return ajax(
|
|
`/admin/customize/site_texts/${params.id}?locale=${params.locale}`
|
|
).then((result) => {
|
|
return this.store.createRecord("site-text", result.site_text);
|
|
});
|
|
},
|
|
|
|
setupController(controller, siteText) {
|
|
const locales = JSON.parse(this.siteSettings.available_locales);
|
|
|
|
const localeFullName = locales.find((locale) => {
|
|
return locale.value === controller.locale;
|
|
}).name;
|
|
|
|
controller.setProperties({
|
|
siteText,
|
|
saved: false,
|
|
localeFullName: localeFullName,
|
|
});
|
|
},
|
|
});
|