Compare commits

..

No commits in common. "209637ee8a875032d4a8754b38010b1afdbaddbb" and "6d6c627c3e7e6f7bda3d2bbd9e5bc5040f347324" have entirely different histories.

4 changed files with 14 additions and 27 deletions

View file

@ -2,8 +2,6 @@ import { throttle } from 'lodash'
import { mapState } from 'pinia'
import { defineAsyncComponent } from 'vue'
import { mapGetters } from 'vuex'
import messages from 'src/i18n/messages'
import localeService from 'src/services/locale/locale.service.js'
import DesktopNav from './components/desktop_nav/desktop_nav.vue'
import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue'
@ -24,8 +22,6 @@ import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_pan
import { getOrCreateServiceWorker } from './services/sw/sw'
import { windowHeight, windowWidth } from './services/window_utils/window_utils'
import { useI18nStore } from 'src/stores/i18n.js'
import { useEmojiStore } from 'src/stores/emoji.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
import { useInterfaceStore } from 'src/stores/interface.js'
@ -77,10 +73,8 @@ export default {
},
created() {
// Load the locale from the storage
const value = useSyncConfigStore().mergedConfig.interfaceLanguage
useI18nStore().setLanguage(value)
useEmojiStore().loadUnicodeEmojiData(value)
const val = useSyncConfigStore().mergedConfig.interfaceLanguage
useSyncConfigStore().setSimplePrefAndSave({ path: 'interfaceLanguage', value: val })
document.getElementById('modal').classList = ['-' + this.layoutType]
// Create bound handlers

View file

@ -2,6 +2,12 @@ import Cookies from 'js-cookie'
import { useEmojiStore } from 'src/stores/emoji.js'
import { useI18nStore } from 'src/stores/i18n.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import messages from 'src/i18n/messages'
import localeService from 'src/services/locale/locale.service.js'
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
export const piniaLanguagePlugin = ({ store, options }) => {
if (store.$id === 'sync_config') {
@ -9,8 +15,12 @@ export const piniaLanguagePlugin = ({ store, options }) => {
if (name === 'setPreference') {
const { path, value } = args[0]
if (path === 'simple.interfaceLanguage') {
useI18nStore().setLanguage(value)
messages.setLanguage(useI18nStore().i18n, value)
useEmojiStore().loadUnicodeEmojiData(value)
Cookies.set(
BACKEND_LANGUAGE_COOKIE_NAME,
localeService.internalToBackendLocaleMulti(value),
)
}
}
})

View file

@ -1,10 +1,6 @@
import Cookies from 'js-cookie'
import messages from 'src/i18n/messages'
import localeService from 'src/services/locale/locale.service.js'
import { defineStore } from 'pinia'
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
export const useI18nStore = defineStore('i18n', {
state: () => ({
i18n: null,
@ -15,12 +11,5 @@ export const useI18nStore = defineStore('i18n', {
i18n: newI18n.global,
})
},
setLanguage(value) {
messages.setLanguage(this.i18n, value)
Cookies.set(
BACKEND_LANGUAGE_COOKIE_NAME,
localeService.internalToBackendLocaleMulti(value),
)
}
},
})

View file

@ -605,15 +605,9 @@ export const useSyncConfigStore = defineStore('sync_config', {
)
cache = null
}
console.log(cache, live)
console.log('======')
console.log('CACHE', cache.prefsStorage.simple.conversationDisplay)
console.log('LIVE', live.prefsStorage.simple.conversationDisplay)
let { recent, stale, needUpload } = _getRecentData(cache, live)
console.log('======')
console.log('RECENT', cache.prefsStorage.simple.conversationDisplay)
console.log('STALE', live.prefsStorage.simple.conversationDisplay)
console.log('======')
const userNew = userData.created_at > NEW_USER_DATE
const flagsTemplate = userNew ? newUserFlags : defaultState.flagStorage