export default {
  methods: {
    onChangeLocale (command) {
      this.$i18n.locale = command
      let message = this.$t('page.layout.locales.changed', { name: this.$t('_name'), locale: this.$i18n.locale })
      if (process.env.VUE_APP_BUILD_MODE === 'PREVIEW') {
        message = [
          this.$t('page.layout.locales.changed', { name: this.$t('_name'), locale: this.$i18n.locale }),
          this.$t('page.layout.locales.preview_warning'),
          this.$t('page.layout.locales.preview_doc')
        ].join('<br/>')
      }
      this.$notify({
        title: this.$t('page.layout.locales.notification_title'),
        dangerouslyUseHTMLString: true,
        message
      })
      this.$store.dispatch('d2admin/menu/menuReload')
    }
  }
}
