refactor: remove i18n dependency and related code
- Removed the i18n module and its related functions from the project. - Eliminated the usage of getActiveI18n and related locale handling in various components and stores. - Updated translation handling to use a new instance creation method. - Cleaned up unused imports and code related to language detection and cookie management. - Adjusted components to directly utilize the new translation setup.
This commit is contained in:
@@ -172,12 +172,12 @@
|
||||
</section>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useTranslation } from 'i18next-vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { t, i18next } = useTranslation();
|
||||
console.log('Current locale:', i18next);
|
||||
const getFeatureList = (key: string): string[] => {
|
||||
const localized = t(key, { returnObjects: true });
|
||||
return Array.isArray(localized) ? localized.map((item) => String(item)) : [];
|
||||
|
||||
@@ -12,9 +12,8 @@ import UploadIcon from '@/components/icons/UploadIcon.vue';
|
||||
import { useAppToast } from '@/composables/useAppToast';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useQuery } from '@pinia/colada';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useTranslation } from 'i18next-vue';
|
||||
import { getActiveI18n } from '@/i18n';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
const toast = useAppToast();
|
||||
const auth = useAuthStore();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import AppButton from '@/components/app/AppButton.vue';
|
||||
import AppDialog from '@/components/app/AppDialog.vue';
|
||||
import AppInput from '@/components/app/AppInput.vue';
|
||||
@@ -8,19 +7,18 @@ import CheckIcon from '@/components/icons/CheckIcon.vue';
|
||||
import LockIcon from '@/components/icons/LockIcon.vue';
|
||||
import TelegramIcon from '@/components/icons/TelegramIcon.vue';
|
||||
import XCircleIcon from '@/components/icons/XCircleIcon.vue';
|
||||
import { supportedLocales, type SupportedLocale } from '@/i18n/constants';
|
||||
import { normalizeLocale } from '@/i18n';
|
||||
import { useAppConfirm } from '@/composables/useAppConfirm';
|
||||
import { useAppToast } from '@/composables/useAppToast';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { supportedLocales } from '@/i18n/constants';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useTranslation } from 'i18next-vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
const auth = useAuthStore();
|
||||
const toast = useAppToast();
|
||||
const confirm = useAppConfirm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const selectedLanguage = ref<SupportedLocale>(normalizeLocale((auth.user as any)?.language ?? (auth.user as any)?.locale));
|
||||
const languageSaving = ref(false);
|
||||
|
||||
const languageOptions = computed(() => supportedLocales.map((value) => ({
|
||||
@@ -29,7 +27,7 @@ const languageOptions = computed(() => supportedLocales.map((value) => ({
|
||||
})));
|
||||
|
||||
watch(() => auth.user, (nextUser) => {
|
||||
selectedLanguage.value = normalizeLocale((nextUser as any)?.language ?? (nextUser as any)?.locale);
|
||||
// selectedLanguage.value = normalizeLocale((nextUser as any)?.language ?? (nextUser as any)?.locale);
|
||||
}, { deep: true });
|
||||
|
||||
// 2FA state
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { ModelVideo } from '@/api/client';
|
||||
import { formatBytes, getStatusSeverity } from '@/lib/utils';
|
||||
import { computed } from 'vue';
|
||||
import { useTranslation } from 'i18next-vue';
|
||||
import { getActiveI18n } from '@/i18n';
|
||||
import { computed } from 'vue';
|
||||
// import { getActiveI18n } from '@/i18n';
|
||||
|
||||
const props = defineProps<{
|
||||
video: ModelVideo;
|
||||
|
||||
Reference in New Issue
Block a user