Skip to content

Commit a592111

Browse files
committed
Put back a removed button by accident
1 parent 70e269a commit a592111

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

assets/javascripts/discourse/initializers/extend-for-translate-button.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ function customizeWidgetPostMenu(api) {
134134
post.set("translated_text", "");
135135
}
136136
});
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+
});
137155
}
138156

139157
export default {

0 commit comments

Comments
 (0)