We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 70e269a commit a592111Copy full SHA for a592111
assets/javascripts/discourse/initializers/extend-for-translate-button.js
@@ -134,6 +134,24 @@ function customizeWidgetPostMenu(api) {
134
post.set("translated_text", "");
135
}
136
});
137
+
138
+ api.addPostMenuButton("translate", (attrs, state) => {
139
+ if (!attrs.can_translate) {
140
+ return;
141
+ }
142
143
+ const [action, title] = !state.isTranslated
144
+ ? ["translate", "translator.view_translation"]
145
+ : ["hideTranslation", "translator.hide_translation"];
146
147
+ return {
148
+ action,
149
+ title,
150
+ icon: "globe",
151
+ position: "first",
152
+ className: state.isTranslated ? "translated" : null,
153
+ };
154
+ });
155
156
157
export default {
0 commit comments