diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 6d7cd3a0..3daac8a3 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 { @@ -136,6 +137,13 @@ const PostStatusForm = { this.$refs.textarea.focus() } }, + setup() { + const {postLanguageOptions} = usePostLanguageOptions() + + return { + postLanguageOptions, + } + }, data () { const preset = this.$route.query.message let statusText = preset || '' @@ -145,7 +153,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 const isoLanguage = interfaceToISOLanguage(interfaceLanguage) @@ -158,7 +167,7 @@ const PostStatusForm = { poll: {}, mediaDescriptions: {}, visibility: this.suggestedVisibility(), - language: isoLanguage, + language: postLanguage, contentType } @@ -173,7 +182,7 @@ const PostStatusForm = { poll: this.statusPoll || {}, mediaDescriptions: this.statusMediaDescriptions || {}, visibility: this.statusScope || this.suggestedVisibility(), - language: this.statusLanguage || isoLanguage, + language: this.statusLanguage || postLanguage, contentType: statusContentType } } @@ -318,9 +327,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..ab786e43 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') }} +