Skip to content

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

feat: i18n for quickstart component (#153)

Yunwei Xiao79c13c576a3c
diff --git a/frontend/src/bbkit/test.svg b/frontend/src/bbkit/test.svg
deleted file mode 100644
index e99b03111c..0000000000
--- a/frontend/src/bbkit/test.svg
+++ /dev/null
@@ -1,51 +0,0 @@
-<svg
- class="w-4 h-4"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- v-if="style == 'DELETE'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
- ></path>
- <path
- v-if="style == 'ARCHIVE'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"
- ></path>
- <path
- v-if="style == 'RESTORE'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"
- ></path>
-
- <path
- v-if="style == 'DISABLE'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
- ></path>
- <path
- v-if="style == 'EDIT'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
- ></path>
- <path
- v-if="style == 'CLONE'"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
- ></path>
- </svg>
\ No newline at end of file
diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vue
index 140445b734..309e745895 100644
--- a/frontend/src/components/Quickstart.vue
+++ b/frontend/src/components/Quickstart.vue
@@ -15,15 +15,7 @@
<router-link :to="intro.link" class="group">
<span class="flex items-start">
<span
- class="
- flex-shrink-0
- relative
- h-5
- w-5
- flex
- items-center
- justify-center
- "
+ class="flex-shrink-0 relative h-5 w-5 flex items-center justify-center"
>
<template v-if="intro.done">
<!-- Heroicon name: solid/check-circle -->
@@ -41,24 +33,12 @@
</template>
<template v-else>
<div
- class="
- h-2
- w-2
- bg-gray-300
- rounded-full
- group-hover:bg-gray-400
- "
+ class="h-2 w-2 bg-gray-300 rounded-full group-hover:bg-gray-400"
></div>
</template>
</span>
<span
- class="
- ml-2
- text-sm
- font-medium
- text-control-light
- group-hover:text-control-light-hover
- "
+ class="ml-2 text-sm font-medium text-control-light group-hover:text-control-light-hover"
:class="intro.done ? 'line-through' : ''"
>{{ intro.name }}</span
>
@@ -73,6 +53,8 @@
<script lang="ts">
import { computed, reactive, ComputedRef } from "vue";
import { useStore } from "vuex";
+import { useI18n } from "vue-i18n";
+
import { isDBA, isOwner } from "../utils";
type IntroItem = {
@@ -84,18 +66,17 @@ type IntroItem = {
};
export default {
- name: "Quickstart",
- components: {},
- props: {},
- emits: [""],
+ name: "QuickStart",
+
setup() {
const store = useStore();
+ const { t } = useI18n();
const currentUser = computed(() => store.getters["auth/currentUser"]());
const introList: IntroItem[] = reactive([
{
- name: "Bookmark an issue",
+ name: computed(() => t("quick-start.bookmark-an-issue")),
link: "/issue/hello-world-101",
allowDBA: true,
allowDeveloper: true,
@@ -104,7 +85,7 @@ export default {
}),
},
{
- name: "Add a comment",
+ name: computed(() => t("quick-start.add-a-comment")),
link: "/issue/hello-world-101#activity101",
allowDBA: true,
allowDeveloper: true,
@@ -113,7 +94,7 @@ export default {
}),
},
{
- name: "Visit project",
+ name: computed(() => t("quick-start.visit-project")),
link: "/project",
allowDBA: true,
allowDeveloper: true,
@@ -122,7 +103,7 @@ export default {
}),
},
{
- name: "Visit environment",
+ name: computed(() => t("quick-start.visit-environment")),
link: "/environment",
allowDBA: true,
allowDeveloper: false,
@@ -131,7 +112,7 @@ export default {
}),
},
{
- name: "Visit instance",
+ name: computed(() => t("quick-start.visit-instance")),
link: "/instance",
allowDBA: true,
allowDeveloper: !store.getters["plan/feature"]("bb.dba-workflow"),
@@ -140,7 +121,7 @@ export default {
}),
},
{
- name: "Visit database",
+ name: computed(() => t("quick-start.visit-database")),
link: "/db",
allowDBA: true,
allowDeveloper: true,
@@ -149,7 +130,7 @@ export default {
),
},
{
- name: "Add a member",
+ name: computed(() => t("quick-start.add-a-member")),
link: "/setting/member",
allowDBA: false,
allowDeveloper: false,
@@ -188,9 +169,8 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "INFO",
- title: `Quickstart guide dismissed`,
- description:
- "You can still bring it back later from the top right menu",
+ title: computed(() => t("quick-start.notice.title")),
+ description: computed(() => t("quick-start.notice.desc")),
manualHide: true,
});
});
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.yml
index 0245a318e3..ce8367d59d 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -20,6 +20,7 @@ common:
edit: Edit
create: Create
update: Update
+ visit: Visit
role:
dba: DBA
owner: Owner
@@ -152,3 +153,14 @@ instance:
select: Select instance
environment:
select: Select environment
+quick-start:
+ bookmark-an-issue: Bookmark an issue
+ add-a-comment: Add a comment
+ visit-project: '@:common.visit @:common.projects'
+ visit-instance: '@:common.visit @:common.instances'
+ visit-database: '@:common.visit @:common.databases'
+ visit-environment: '@:common.visit @:common.environments'
+ add-a-member: Add a member
+ notice:
+ title: Quickstart guide dismissed
+ desc: You can still bring it back later from the top right menu
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 26e6ca41d0..ed89daa3c4 100644
--- a/frontend/src/locales/zh-CN.yml
+++ b/frontend/src/locales/zh-CN.yml
@@ -20,6 +20,7 @@ common:
edit: 编辑
create: 创建
update: 更新
+ visit: 访问
role:
dba: DBA
owner: 所有者
@@ -135,3 +136,14 @@ instance:
select: 选择实例
environment:
select: 选择环境
+quick-start:
+ bookmark-an-issue: 收藏工单
+ add-a-comment: 添加评论
+ visit-project: '@:common.visit@:common.projects'
+ visit-instance: '@:common.visit@:common.instances'
+ visit-database: '@:common.visit@:common.databases'
+ visit-environment: '@:common.visit@:common.environments'
+ add-a-member: 添加成员
+ notice:
+ title: 快速入门导览已关闭
+ desc: 您稍后仍可以从右上角的菜单中再次打开快速入门导览