Skip to content

Commit

Permalink
feat: Implement the administration management of automatic translatio…
Browse files Browse the repository at this point in the history
…n for news - EXO-72353 - Meeds-io/MIPs#129 (#92) (#94)
  • Loading branch information
sofyenne authored Sep 19, 2024
1 parent 0b49780 commit f19a5b7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
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'));
}

0 comments on commit f19a5b7

Please sign in to comment.