Skip to content

Commit

Permalink
Merge pull request #4 from ohos-rs/feat-i18n
Browse files Browse the repository at this point in the history
feat: add i18n
  • Loading branch information
richerfu authored Jun 19, 2024
2 parents b73bc66 + 1c7e2fb commit 0616e6d
Show file tree
Hide file tree
Showing 55 changed files with 2,359 additions and 416 deletions.
52 changes: 0 additions & 52 deletions .vitepress/config.mts

This file was deleted.

11 changes: 11 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "vitepress";
import { shared } from "./shared";
import { en, zh } from "./i18n";

export default defineConfig({
...shared,
locales: {
root: { label: "简体中文", ...zh },
en: { label: "English", ...en },
},
});
43 changes: 43 additions & 0 deletions .vitepress/i18n/en/BasicSideBar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { DefaultTheme } from "vitepress";

export const BasicSideBar: DefaultTheme.SidebarItem[] = [
{
text: "Basic",
link: "/en/docs/basic",
items: [
{ text: "Quick Start", link: "/en/docs/basic/quick-start" },
{ text: "Simple Project", link: "/en/docs/basic/simple-project" },
],
},
{
text: "Cli",
collapsed: false,
items: [
{ text: "Init", link: "/en/docs/cli/init" },
{ text: "Build", link: "/en/docs/cli/build" },
{ text: "Artifact", link: "/en/docs/cli/artifact" },
],
},
{
text: "Usage",
collapsed: false,
items: [
{ text: "Basic", link: "/en/docs/usage/basic" },
{ text: "Task", link: "/en/docs/usage/task" },
{ text: "ThreadSafeFunction", link: "/en/docs/usage/tsfn" },
],
},
{
text: "CD/CD",
collapsed: false,
items: [{ text: "CI", link: "/en/docs/ci/basic.md" }],
},
{
text: "More",
items: [
{ text: "F & Q", link: "/en/docs/more/f&q" },
{ text: "Known issue", link: "/en/docs/more/known-issue" },
{ text: "EMU-TLS", link: "/en/docs/more/emu-tls" },
],
},
];
8 changes: 8 additions & 0 deletions .vitepress/i18n/en/Blog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { DefaultTheme } from "vitepress";

export const BlogSideBar: DefaultTheme.SidebarItem[] = [
{
text: "2024-05-27",
link: "/en/blog/2024-05-27",
},
];
45 changes: 45 additions & 0 deletions .vitepress/i18n/en/Ecosystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { DefaultTheme } from "vitepress";

export const EcosystemSideBar: DefaultTheme.SidebarItem[] = [
{
text: "@ohos-rs",
collapsed: false,
items: [
{ text: "crc32", link: "/en/ecosystem/package/crc32" },
{ text: "jieba", link: "/en/ecosystem/package/jieba" },
{ text: "argon2", link: "/en/ecosystem/package/argon2" },
{ text: "bcrypt", link: "/en/ecosystem/package/bcrypt" },
{ text: "jsonwebtoken", link: "/en/ecosystem/package/jsonwebtoken" },
{ text: "snappy", link: "/en/ecosystem/package/snappy" },
{ text: "xxhash", link: "/en/ecosystem/package/xxhash" },
{ text: "image", link: "/en/ecosystem/package/image" },
],
},
{
text: "Native-binding",
collapsed: false,
items: [
{ text: "hilog", link: "/en/ecosystem/binding/hilog" },
{ text: "init", link: "/en/ecosystem/binding/init" },
],
},
{
text: "Polyfill",
collapsed: false,
items: [
{ text: "AbortController", link: "/en/ecosystem/polyfill/abort-controller" },
],
},
{
text: "Third-Party",
collapsed: false,
items: [
{ text: "OpenSSL", link: "/en/ecosystem/third/openssl" },
{ text: "cURL", link: "/en/ecosystem/third/curl" },
{ text: "MMKV", link: "/en/ecosystem/third/mmkv" },
{ text: "avif", link: "/en/ecosystem/third/avif" },
{ text: "cronet", link: "/en/ecosystem/third/cronet" },
{ text: "BoringSSL", link: "/en/ecosystem/third/boringssl" },
],
},
];
40 changes: 40 additions & 0 deletions .vitepress/i18n/en/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineConfig } from "vitepress";
import { BasicSideBar } from "./BasicSideBar";
import { EcosystemSideBar } from "./Ecosystem";
import { BlogSideBar } from "./Blog";

export const en = defineConfig({
lang: "en-US",
description:
"A framework for building compiled OpenHarmony SDK in Rust via Node-API(Forked from napi-rs)",
themeConfig: {
nav: [
{ text: "Home", link: "/en" },
{ text: "Docs", link: "/en/docs/basic" },
{ text: "Ecosystem", link: "/en/ecosystem/" },
{ text: "Community", link: "/en/community/" },
{ text: "Blog", link: "/en/blog/" },
{
text: "About",
items: [
{ text: "Logo", link: "/en/about/" },
{ text: "Issue", link: "https://github.com/ohos-rs/example/issues" },
],
},
],
sidebar: {
"/en/docs": BasicSideBar,
"/en/ecosystem": EcosystemSideBar,
"/en/blog": BlogSideBar,
"/en/about": [],
},
editLink: {
pattern:
"https://github.com/ohos-rs/ohos-rs.github.io/tree/master/src/:path",
text: "Edit this page on GitHub",
},
lastUpdated: {
text: "Last updated",
},
},
});
2 changes: 2 additions & 0 deletions .vitepress/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './en';
export * from './zh';
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions .vitepress/i18n/zh/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineConfig } from "vitepress";
import { BasicSideBar } from "./BasicSideBar";
import { EcosystemSideBar } from "./Ecosystem";
import { BlogSideBar } from "./Blog";

export const zh = defineConfig({
lang: 'zh-Hans',
description:
"基于 Rust 实现的鸿蒙原生模块开发框架(基于 napi-rs 实现)",
themeConfig: {
nav: [
{ text: "主页", link: "/" },
{ text: "文档", link: "/docs/basic" },
{ text: "生态", link: "/ecosystem/" },
{ text: "社区", link: "/community/" },
{ text: "博客", link: "/blog/" },
{
text: "关于",
items: [
{ text: "Logo", link: "/about/" },
{ text: "Issue", link: "https://github.com/ohos-rs/example/issues" },
],
},
],
sidebar: {
"/docs": BasicSideBar,
"/ecosystem": EcosystemSideBar,
"/blog": BlogSideBar,
"/about": [],
},
editLink: {
pattern:
"https://github.com/ohos-rs/ohos-rs.github.io/tree/master/src/:path",
text: "编辑本页",
},
lastUpdated: {
text: "最新更新于",
},
},
});
19 changes: 19 additions & 0 deletions .vitepress/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from "vitepress";

export const shared = defineConfig({
title: "ohos-rs",
srcDir: "./src",
markdown: {
image: {
lazyLoading: true,
},
},
head: [["link", { rel: "icon", href: "/favicon.ico" }]],
themeConfig: {
logo: "/logo.svg",
socialLinks: [{ icon: "github", link: "https://github.com/ohos-rs" }],
search: {
provider: "local",
},
},
});
Loading

0 comments on commit 0616e6d

Please sign in to comment.