2023-10-11 02:38:59 +08:00
|
|
|
import { alias } from "@ember/object/computed";
|
2023-06-19 22:37:43 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { url } from "discourse/lib/computed";
|
2023-10-11 02:38:59 +08:00
|
|
|
import SiteSettingComponent from "./site-setting";
|
2018-03-05 08:04:23 +08:00
|
|
|
|
2023-02-13 18:53:15 +08:00
|
|
|
export default class ThemeTranslation extends SiteSettingComponent {
|
|
|
|
@alias("translation") setting;
|
|
|
|
@alias("translation.key") settingName;
|
2023-06-19 22:37:43 +08:00
|
|
|
@url("model.id", "/admin/themes/%@") updateUrl;
|
2019-01-17 19:46:11 +08:00
|
|
|
|
2023-02-23 23:32:53 +08:00
|
|
|
type = "string";
|
|
|
|
|
2018-03-05 08:04:23 +08:00
|
|
|
_save() {
|
2023-06-19 22:37:43 +08:00
|
|
|
const translations = {
|
|
|
|
[this.get("translation.key")]: this.get("buffered.value"),
|
|
|
|
};
|
|
|
|
|
|
|
|
return ajax(this.updateUrl, {
|
|
|
|
type: "PUT",
|
2024-03-19 00:00:28 +08:00
|
|
|
data: { theme: { translations, locale: this.get("model.locale") } },
|
2023-06-19 22:37:43 +08:00
|
|
|
});
|
2023-02-13 18:53:15 +08:00
|
|
|
}
|
|
|
|
}
|