Skip to content

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

feat(i18n): added i18n support to archive page (#195)

Luke Zhou6f5577de6306
diff --git a/frontend/src/components/ArchiveBanner.vue b/frontend/src/components/ArchiveBanner.vue
index da3cc39cab..bf02e2b3f3 100644
--- a/frontend/src/components/ArchiveBanner.vue
+++ b/frontend/src/components/ArchiveBanner.vue
@@ -1,18 +1,8 @@
<template>
<div
- class="
- h-8
- w-full
- text-base
- font-medium
- bg-gray-700
- text-white
- flex
- justify-center
- items-center
- "
+ class="h-8 w-full text-base font-medium bg-gray-700 text-white flex justify-center items-center"
>
- Archived
+ {{ $t("archive.archived") }}
</div>
</template>
diff --git a/frontend/src/components/ProjectTable.vue b/frontend/src/components/ProjectTable.vue
index 9bb1c9c65d..7161bfcea3 100644
--- a/frontend/src/components/ProjectTable.vue
+++ b/frontend/src/components/ProjectTable.vue
@@ -36,7 +36,7 @@
</template>
<script lang="ts">
-import { PropType } from "vue";
+import { PropType, computed } from "vue";
import { useRouter } from "vue-router";
import { projectSlug } from "../utils";
import { Project } from "../types";
@@ -55,7 +55,7 @@ export default {
setup(props) {
const router = useRouter();
const { t } = useI18n();
- const COLUMN_LIST = [
+ const COLUMN_LIST = computed(() => [
{
title: t("project.table.key"),
},
@@ -65,7 +65,7 @@ export default {
{
title: t("project.table.created-at"),
},
- ];
+ ]);
const clickProject = function (section: number, row: number) {
const project = props.projectList[row];
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.yml
index 5129b318b8..621e7c9d1a 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -797,3 +797,8 @@ version-control:
view-in-gitlab: View in GitLab
secret-label-gitlab: Secret for the registered GitLab instance-wide OAuth application.
delete: To delete this provider, unlink all repositories first.
+archive:
+ archived: Archived
+ project-search-bar-placeholder: Search @.lower:{'common.project'} name
+ instance-search-bar-placeholder: Search @.lower:{'common.instance'} name
+ environment-search-bar-placeholder: Search @.lower:{'common.environment'} name
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 74a4579488..92f7475541 100644
--- a/frontend/src/locales/zh-CN.yml
+++ b/frontend/src/locales/zh-CN.yml
@@ -700,3 +700,8 @@ version-control:
view-in-gitlab: 查看 GitLab
secret-label-gitlab: 注册为 GitLab 实例级 OAuth 应用的 Secret。
delete: 删除这个提供方前,需要先解除所有仓库的关联。
+archive:
+ archived: 已归档
+ project-search-bar-placeholder: 搜索@.lower:{'common.project'}的名称
+ instance-bar-placeholder: 搜索@.lower:{'common.instance'}的名称
+ environment-bar-placeholder: 搜索@.lower:{'common.environment'}的名称
\ No newline at end of file
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index 4e62376695..13230918c4 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -15,10 +15,10 @@
class="w-56"
:placeholder="
state.selectedIndex == PROJECT_TAB
- ? 'Search project name'
+ ? $t('archive.project-search-bar-placeholder')
: state.selectedIndex == INSTANCE_TAB
- ? 'Search instance name'
- : 'Search environment name'
+ ? $t('archive.instance-search-bar-placeholder')
+ : $t('archive.environment-search-bar-placeholder')
"
@change-text="(text) => changeSearchText(text)"
/>
@@ -53,6 +53,7 @@ import {
} from "../types";
import { isDBAOrOwner } from "../utils";
import { BBTabFilterItem } from "../bbkit/types";
+import { useI18n } from "vue-i18n";
const PROJECT_TAB = 0;
const INSTANCE_TAB = 1;
@@ -67,6 +68,8 @@ export default {
name: "Archive",
components: { EnvironmentTable, InstanceTable, ProjectTable },
setup() {
+ const { t } = useI18n();
+
const state = reactive<LocalState>({
selectedIndex: PROJECT_TAB,
searchText: "",
@@ -113,11 +116,11 @@ export default {
const tabItemList = computed((): BBTabFilterItem[] => {
return isDBAOrOwner(currentUser.value.role)
? [
- { title: "Project", alert: false },
- { title: "Instance", alert: false },
- { title: "Environment", alert: false },
+ { title: t("common.project"), alert: false },
+ { title: t("common.instance"), alert: false },
+ { title: t("common.environment"), alert: false },
]
- : [{ title: "Project", alert: false }];
+ : [{ title: t("common.instance"), alert: false }];
});
const filteredProjectList = (list: Project[]) => {