Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement the administration management of automatic translation for news - EXO-72353 - Meeds-io/MIPs#129 #92

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class AutomaticTranslationFeaturesOptions implements Serializable {

private Boolean newsTranslateView;

private Boolean newsTranslateEdition;

private Boolean notesTranslateEdition;

private Boolean notesTranslateView;
Expand All @@ -39,5 +41,6 @@ public AutomaticTranslationFeaturesOptions() {
this.newsTranslateView = true;
this.notesTranslateEdition = true;
this.notesTranslateView = true;
this.newsTranslateEdition = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ public void testGetFeatureOptions() {
assertTrue(automaticTranslationFeaturesOptions.getNotesTranslateView());
assertTrue(automaticTranslationFeaturesOptions.getStreamTranslateShort());
assertTrue(automaticTranslationFeaturesOptions.getStreamTranslateComment());
assertTrue(automaticTranslationFeaturesOptions.getNewsTranslateEdition());
automaticTranslationFeaturesOptions.setNewsTranslateView(false);
automaticTranslationFeaturesOptions.setNotesTranslateView(false);
translationService.setFeaturesOptions(automaticTranslationFeaturesOptions);
Expand All @@ -332,6 +333,7 @@ public void testGetFeatureOptions() {
assertTrue(automaticTranslationFeaturesOptions.getStreamTranslateShort());
assertTrue(automaticTranslationFeaturesOptions.getStreamTranslateComment());
assertTrue(automaticTranslationFeaturesOptions.getNotesTranslateEdition());
assertTrue(automaticTranslationFeaturesOptions.getNewsTranslateEdition());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ automatic.translation.administration.module.news.label=News
automatic.translation.administration.module.notes.label=Notes
automatic.translation.administration.module.stream.short.message=Short message
automatic.translation.administration.module.stream.comments=Comment
automatic.translation.administration.module.news.write=News - edition
automatic.translation.administration.module.news.write=News edition
automatic.translation.administration.module.news.view=News consultation
automatic.translation.administration.module.notes.write=Notes edition
automatic.translation.administration.module.notes.view=Notes consultation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<span class="font-weight-bold">
{{ $t('automatic.translation.administration.module.news.label') }}
</span>
<v-row no-gutters>
<v-col class="my-auto">
{{ $t('automatic.translation.administration.module.news.write') }}
</v-col>
<v-col class="my-auto">
<v-switch
v-model="featuresOptions.newsTranslateEdition"
class="pa-0 mb-0 mt-2"
@click="updateFeaturesOptions" />
</v-col>
</v-row>
<v-row no-gutters>
<v-col class="my-auto">
{{ $t('automatic.translation.administration.module.news.view') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function initExt() {
Vue.prototype.$automaticTranslationExtensionsService.getFeaturesOptions().then(data => {
let featuresOptions = {
notesTranslateEdition: true,
newsTranslateEdition: true,
};
if (data){
featuresOptions = data;
Expand All @@ -55,5 +56,14 @@ export function initExtensions(featuresOptions) {
},
});
}
if (featuresOptions?.newsTranslateEdition){
extensionRegistry.registerExtension('contentEditor', 'translation-extension', {
id: 'content-editor-auto-translate',
rank: 1001,
componentOptions: {
vueComponent: Vue.options.components['note-editor-automatic-translation'],
},
});
}
document.dispatchEvent(new CustomEvent('automatic-translation-extensions-updated'));
}