Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 3.4.0.beta3-dev: aa294470824ede8ac32b358390a8bb407f50fee8
< 3.4.0.beta1-dev: 5346b4bafba2c2fb817f030a473b7bbca97b909c
< 3.3.0.beta1-dev: 6750e10a6d9dfd3fc2c9a0cac5a83aca1a8ee401
3.1.999: 20aed65b909fb41e22181067dc990b52ab0b7a96
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { tracked } from "@glimmer/tracking";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { withPluginApi } from "discourse/lib/plugin-api";
import { withSilencedDeprecations } from "discourse-common/lib/deprecated";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import ToggleTranslationButton from "../components/post-menu/toggle-translation-button";
import TranslatedPost from "../components/translated-post";

Expand All @@ -27,18 +26,14 @@ function customizePostMenu(api, container) {
);

if (transformerRegistered) {
// the plugin outlet is not updated when the post instance is modified unless we extend it to add the tracking to
// the new properties
api.modifyClass(
"model:post",
(Superclass) =>
class extends Superclass {
@tracked detectedLang;
@tracked isTranslating;
@tracked isTranslated;
@tracked translatedText;
@tracked translatedTitle;
}
// the plugin outlet is not updated when the post instance is modified unless we register the new properties as
// tracked
api.addTrackedPostProperties(
"detectedLang",
"isTranslating",
"isTranslated",
"translatedText",
"translatedTitle"
);

api.renderBeforeWrapperOutlet("post-menu", TranslatedPost);
Expand Down Expand Up @@ -86,7 +81,7 @@ function customizeWidgetPostMenu(api) {
...titleElements,
dec.h(
"div.post-attribution",
I18n.t("translator.translated_from", { language, translator })
i18n("translator.translated_from", { language, translator })
),
dec.cooked(dec.attrs.translated_text),
]);
Expand Down Expand Up @@ -151,6 +146,6 @@ function customizeWidgetPostMenu(api) {
export default {
name: "extend-for-translate-button",
initialize() {
withPluginApi("1.34.0", (api) => initializeTranslation(api));
withPluginApi("1.39.2", (api) => initializeTranslation(api));
},
};
Loading