discourse/app/assets/javascripts/admin/addon/components/theme-translation.js
Gabriel Grubba 8ae462c724
FEATURE: add language picker for theme translations in admin UI (#26150)
Allows editing translations of a theme in locales other than the current localy.
2024-03-18 12:00:28 -04:00

24 lines
657 B
JavaScript

import { alias } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax";
import { url } from "discourse/lib/computed";
import SiteSettingComponent from "./site-setting";
export default class ThemeTranslation extends SiteSettingComponent {
@alias("translation") setting;
@alias("translation.key") settingName;
@url("model.id", "/admin/themes/%@") updateUrl;
type = "string";
_save() {
const translations = {
[this.get("translation.key")]: this.get("buffered.value"),
};
return ajax(this.updateUrl, {
type: "PUT",
data: { theme: { translations, locale: this.get("model.locale") } },
});
}
}