diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index aab74f2a..d7c549d6 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -397,6 +397,7 @@ const afterStoreSetup = async ({ store, i18n }) => {
store.dispatch('startFetchingAnnouncements')
getTOS({ store })
getStickers({ store })
+ store.dispatch('getSupportedTranslationlanguages')
const router = createRouter({
history: createWebHistory(),
diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js
index 39d9b31e..f72f309c 100644
--- a/src/components/settings_modal/tabs/general_tab.js
+++ b/src/components/settings_modal/tabs/general_tab.js
@@ -83,6 +83,9 @@ const GeneralTab = {
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
}
},
+ translationLanguages () {
+ return (this.$store.getters.mergedConfig.supportedTranslationLanguages || []).map(lang => ({ key: lang.code, value: lang.code, label: lang.name }))
+ },
translationLanguage: {
get: function () { return this.$store.getters.mergedConfig.translationLanguage },
set: function (val) {
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 3a8d5157..72d877bd 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -157,14 +157,14 @@
-
-
-
+
+ {{ $t('settings.translation_language') }}
+
{
+ store.dispatch('setInstanceOption', { name: 'supportedTranslationLanguages', value: data })
+ })
+ },
// Pleroma websocket
setWsToken (store, token) {
diff --git a/src/modules/config.js b/src/modules/config.js
index 0ccdfc99..82257ddf 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -115,7 +115,8 @@ export const defaultState = {
conversationOtherRepliesButton: undefined, // instance default
conversationTreeFadeAncestors: undefined, // instance default
maxDepthInThread: undefined, // instance default
- translationLanguage: undefined // instance default
+ translationLanguage: undefined, // instance default,
+ supportedTranslationLanguages: [] // instance default
}
// caching the instance default properties
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index cc2da9c5..771929d4 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -31,6 +31,7 @@ const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
const MASTODON_REGISTRATION_URL = '/api/v1/accounts'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
+const AKKOMA_LANGUAGES_URL = '/api/v1/akkoma/translation/languages'
const AKKOMA_TRANSLATE_URL = (id, lang) => `/api/v1/statuses/${id}/translations/${lang}`
const MASTODON_DISMISS_NOTIFICATION_URL = id => `/api/v1/notifications/${id}/dismiss`
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
@@ -739,6 +740,10 @@ const unretweet = ({ id, credentials }) => {
.then((data) => parseStatus(data))
}
+const getSupportedTranslationlanguages = ({ credentials }) => {
+ return promisedRequest({ url: AKKOMA_LANGUAGES_URL, credentials })
+}
+
const translateStatus = ({ id, credentials, language }) => {
return promisedRequest({ url: AKKOMA_TRANSLATE_URL(id, language), method: 'GET', credentials })
.then((data) => {
@@ -1585,7 +1590,8 @@ const apiService = {
editAnnouncement,
deleteAnnouncement,
adminFetchAnnouncements,
- translateStatus
+ translateStatus,
+ getSupportedTranslationlanguages
}
export default apiService
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index 41fa34fc..bedc51b2 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -40,6 +40,10 @@ const backendInteractorService = credentials => ({
return ProcessedWS({ url, id: 'User' })
},
+ getSupportedTranslationlanguages ({ store }) {
+ return apiService.getSupportedTranslationlanguages({ store, credentials })
+ },
+
...Object.entries(apiService).reduce((acc, [key, func]) => {
return {
...acc,