Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: not use useI18n in ts file (#14298)

ecmadao82a19218f73a
diff --git a/frontend/src/components/VCS/utils.ts b/frontend/src/components/VCS/utils.ts
index 97c4ee4673..50f6c58211 100644
--- a/frontend/src/components/VCS/utils.ts
+++ b/frontend/src/components/VCS/utils.ts
@@ -1,5 +1,5 @@
import { computed } from "vue";
-import { useI18n } from "vue-i18n";
+import { t } from "@/plugins/i18n";
import type { VCSUIType } from "@/types";
import { VCSType } from "@/types/proto/v1/common";
@@ -9,8 +9,6 @@ export const vcsListByUIType = computed(
uiType: VCSUIType;
title: string;
}[] => {
- const { t } = useI18n();
-
return [
{
type: VCSType.GITLAB,
diff --git a/frontend/src/plugins/i18n.ts b/frontend/src/plugins/i18n.ts
index e8e0eb35fc..50601a35a2 100644
--- a/frontend/src/plugins/i18n.ts
+++ b/frontend/src/plugins/i18n.ts
@@ -65,4 +65,6 @@ export const t = i18n.global.t;
export const te = i18n.global.te;
+export const locale = i18n.global.locale;
+
export default i18n;
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 399ab9e478..467ba258f4 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -1,4 +1,4 @@
-import { useI18n } from "vue-i18n";
+import { t } from "@/plugins/i18n";
import {
PlanType,
planTypeFromJSON,
@@ -125,7 +125,6 @@ export const PLANS: Plan[] = planData.planList.map((raw: Plan) => ({
}));
export const getFeatureLocalization = (feature: PlanFeature): PlanFeature => {
- const { t } = useI18n();
for (const section of FEATURE_SECTIONS) {
if (new Set(section.featureList).has(feature.type)) {
const res: PlanFeature = {
diff --git a/frontend/src/types/semanticTypes.ts b/frontend/src/types/semanticTypes.ts
index e178d537c2..d13af430c5 100644
--- a/frontend/src/types/semanticTypes.ts
+++ b/frontend/src/types/semanticTypes.ts
@@ -1,5 +1,5 @@
import { v4 as uuidv4 } from "uuid";
-import { useI18n } from "vue-i18n";
+import { t } from "@/plugins/i18n";
import { SemanticTypeSetting_SemanticType } from "@/types/proto/v1/setting_service";
import buildInSemanticTypes from "./semantic-types.yaml";
@@ -10,7 +10,6 @@ interface BuildInSemantic {
}
export const getSemanticTemplateList = () => {
- const { t } = useI18n();
return (buildInSemanticTypes as BuildInSemantic[]).map((buildInSemantic) =>
SemanticTypeSetting_SemanticType.fromPartial({
id: uuidv4(),
diff --git a/frontend/src/utils/v1/instance.ts b/frontend/src/utils/v1/instance.ts
index e554fbe53b..b4386f7373 100644
--- a/frontend/src/utils/v1/instance.ts
+++ b/frontend/src/utils/v1/instance.ts
@@ -1,7 +1,6 @@
import { keyBy, orderBy } from "lodash-es";
import { computed, unref } from "vue";
-import { useI18n } from "vue-i18n";
-import { t } from "@/plugins/i18n";
+import { t, locale } from "@/plugins/i18n";
import { useEnvironmentV1Store, useSubscriptionV1Store } from "@/store";
import type { ComposedInstance, MaybeRef } from "@/types";
import { isValidProjectName, languageOfEngineV1 } from "@/types";
@@ -99,7 +98,6 @@ export const sortInstanceV1ListByEnvironmentV1 = <T extends Instance>(
};
export const supportedEngineV1List = () => {
- const { locale } = useI18n();
const engines: Engine[] = [
Engine.MYSQL,
Engine.POSTGRES,
@@ -249,10 +247,7 @@ export const instanceV1SupportsConciseSchema = (
instanceOrEngine: Instance | InstanceResource | Engine
) => {
const engine = engineOfInstanceV1(instanceOrEngine);
- return [
- Engine.ORACLE,
- Engine.POSTGRES,
- ].includes(engine);
+ return [Engine.ORACLE, Engine.POSTGRES].includes(engine);
};
export const instanceV1SupportsTablePartition = (