diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 703d8a63..e61c9e53 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -9,11 +9,12 @@ import StatusContent from '../status_content/status_content.vue' import fileTypeService from '../../services/file_type/file_type.service.js' import { findOffset } from '../../services/offset_finder/offset_finder.service.js' import { reject, map, uniqBy, debounce } from 'lodash' +import { usePostLanguageOptions } from 'src/lib/post_language' import suggestor from '../emoji_input/suggestor.js' import { mapGetters, mapState } from 'vuex' import Checkbox from '../checkbox/checkbox.vue' import Select from '../select/select.vue' -import iso6391 from 'iso-639-1' + import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -129,6 +130,13 @@ const PostStatusForm = { this.$refs.textarea.focus() } }, + setup() { + const {postLanguageOptions} = usePostLanguageOptions() + + return { + postLanguageOptions, + } + }, data () { const preset = this.$route.query.message let statusText = preset || '' @@ -138,7 +146,8 @@ const PostStatusForm = { statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) } - const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig + const { postContentType: contentType, postLanguage: defaultPostLanguage, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig + const postLanguage = defaultPostLanguage || interfaceLanguage let statusParams = { spoilerText: this.subject || '', @@ -149,7 +158,7 @@ const PostStatusForm = { poll: {}, mediaDescriptions: {}, visibility: this.suggestedVisibility(), - language: interfaceLanguage, + language: postLanguage, contentType } @@ -164,7 +173,7 @@ const PostStatusForm = { poll: this.statusPoll || {}, mediaDescriptions: this.statusMediaDescriptions || {}, visibility: this.statusScope || this.suggestedVisibility(), - language: this.statusLanguage || interfaceLanguage, + language: this.statusLanguage || postLanguage, contentType: statusContentType } } @@ -309,9 +318,6 @@ const PostStatusForm = { ...mapState({ mobileLayout: state => state.interface.mobileLayout }), - isoLanguages () { - return iso6391.getAllCodes(); - } }, watch: { 'newStatus': { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 74663fd7..f83383dc 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -208,11 +208,11 @@ class="form-control" > diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index 763a588d..d21fb5b9 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -4,6 +4,7 @@ import ScopeSelector from 'src/components/scope_selector/scope_selector.vue' import IntegerSetting from '../helpers/integer_setting.vue' import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue' +import { usePostLanguageOptions } from 'src/lib/post_language' import SharedComputedObject from '../helpers/shared_computed_object.js' import ServerSideIndicator from '../helpers/server_side_indicator.vue' import { library } from '@fortawesome/fontawesome-svg-core' @@ -17,6 +18,11 @@ library.add( ) const GeneralTab = { + setup() { + const {postLanguageOptions} = usePostLanguageOptions() + + return {postLanguageOptions} + }, data () { return { subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({ @@ -118,6 +124,12 @@ const GeneralTab = { this.$store.dispatch('setOption', { name: 'translationLanguage', value: val }) } }, + postLanguage: { + get: function () { return this.$store.getters.mergedConfig.postLanguage }, + set: function (val) { + this.$store.dispatch('setOption', { name: 'postLanguage', value: val }) + } + }, ...SharedComputedObject() }, methods: { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 64950f8a..e31cb5d6 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -585,6 +585,15 @@ {{ $t('settings.post_status_content_type') }} +