Skip to content

Commit f100130

Browse files
committed
🌐 🤖 简单实现了批量全量翻译,上线了英文文档
1 parent c3cedf6 commit f100130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3879
-94
lines changed

docs/.vitepress/config.mts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default defineConfig({
4646
);
4747
},
4848
}),
49-
] ,
49+
],
5050
},
5151
head: [["link", { rel: "icon", type: "image/svg+xml", href: "/logo.svg" }]],
5252
themeConfig: {
@@ -71,8 +71,17 @@ export default defineConfig({
7171
}
7272
: undefined,
7373
},
74+
rewrites(id) {
75+
return id.replace(/^i18n\//, "");
76+
},
7477
locales: Object.keys(all).reduce((locales, key) => {
75-
locales[key === rootLang ? "root" : key] = i18n(key, all[key]);
78+
const isRoot = key === rootLang;
79+
locales[isRoot ? "root" : key] = i18n(
80+
key,
81+
all[key],
82+
isRoot ? "/" : `/i18n/${key}/`,
83+
isRoot ? "/" : `/${key}/`
84+
);
7685
return locales;
7786
}, {}),
7887
vite: vite as any,

docs/.vitepress/i18n.mts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from "node:fs";
22
import path from "node:path";
33
import { type DefaultTheme, LocaleConfig } from "vitepress";
44
import { dirToSilderItem } from "./navPlugins";
5+
import { formatWithOptions } from "node:util";
56

67
const html = String.raw;
78

@@ -23,16 +24,24 @@ export const getAllLocaleConfig = () => {
2324
};
2425
export const i18n = (
2526
lang: string,
26-
m: LangConfig
27+
m: LangConfig,
28+
dirBase = lang === rootLang ? "/" : `/${lang}/`,
29+
urlBase = dirBase
2730
): LocaleConfig<DefaultTheme.Config>[string] => {
28-
const isRoot = lang === rootLang;
29-
const base = isRoot ? "/" : `/${lang}/`;
3031
const developerSlidbar = dirToSilderItem(
31-
path.join(import.meta.dirname, `..${base}developer`, base)
32+
path.join(import.meta.dirname, `..${dirBase}developer`),
33+
urlBase
3234
);
3335
const helpSlidbar = dirToSilderItem(
34-
path.join(import.meta.dirname, `..${base}help`, base)
36+
path.join(import.meta.dirname, `..${dirBase}help`),
37+
urlBase
3538
);
39+
if (urlBase !== "/") {
40+
console.log(
41+
"developerSlidbar",
42+
formatWithOptions({ depth: Infinity, colors: true }, developerSlidbar)
43+
);
44+
}
3645
return {
3746
label: m.label,
3847
lang,
@@ -42,11 +51,11 @@ export const i18n = (
4251
nav: [
4352
{
4453
text: developerSlidbar.text,
45-
link: "/developer/",
54+
link: `${urlBase}developer/`,
4655
},
4756
{
4857
text: helpSlidbar.text,
49-
link: "/help/",
58+
link: `${urlBase}help/`,
5059
},
5160
{
5261
text: m.nav.maintainerDoc,
@@ -63,17 +72,17 @@ export const i18n = (
6372
},
6473
{
6574
text: m.nav.downloads,
66-
link: "/downloads",
75+
link: `${urlBase}downloads`,
6776
},
6877
],
6978

7079
sidebar: {
71-
dev: {
80+
[`${urlBase}dev`]: {
7281
base: "",
7382
items: [],
7483
...developerSlidbar,
7584
},
76-
help: {
85+
[`${urlBase}help`]: {
7786
base: "",
7887
items: [],
7988
...helpSlidbar,

docs/.vitepress/i18n/en.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"label": "English",
3+
"description": "A browser that provides distributed network | application attachment.",
4+
"editLink": "Edit this page on GitHub",
5+
"footer": {
6+
"message": "Released under the MIT License",
7+
"copyright": "Copyright © 2021-2025"
8+
},
9+
"docFooter": {
10+
"prev": "Previous",
11+
"next": "Next"
12+
},
13+
"lastUpdated": "Last updated",
14+
"outline": {
15+
"label": "Page Navigation"
16+
},
17+
"langMenuLabel": "Languages",
18+
"returnToTopLabel": "Back to top",
19+
"sidebarMenuLabel": "Menu",
20+
"darkModeSwitchLabel": "Theme",
21+
"lightModeSwitchTitle": "Switch to light mode",
22+
"darkModeSwitchTitle": "Switch to dark mode",
23+
"nav": {
24+
"maintainerDoc": "Core Maintainer Documentation",
25+
"developmentLog": "Development Log",
26+
"gettingStartedMaintainer": "Getting Started for Core Developers",
27+
"downloads": "Downloads"
28+
},
29+
"search": {
30+
"placeholder": "Search documentation",
31+
"translations": {
32+
"button": { "buttonText": "Search documentation", "buttonAriaLabel": "Search documentation" },
33+
"modal": {
34+
"searchBox": {
35+
"resetButtonTitle": "Clear search criteria",
36+
"resetButtonAriaLabel": "Clear search criteria",
37+
"cancelButtonText": "Cancel",
38+
"cancelButtonAriaLabel": "Cancel"
39+
},
40+
"startScreen": {
41+
"recentSearchesTitle": "Search history",
42+
"noRecentSearchesText": "No search history",
43+
"saveRecentSearchButtonTitle": "Save to search history",
44+
"removeRecentSearchButtonTitle": "Remove from search history",
45+
"favoriteSearchesTitle": "Favorites",
46+
"removeFavoriteSearchButtonTitle": "Remove from favorites"
47+
},
48+
"errorScreen": {
49+
"titleText": "Unable to fetch results",
50+
"helpText": "You may need to check your network connection"
51+
},
52+
"footer": {
53+
"selectText": "Select",
54+
"navigateText": "Navigate",
55+
"closeText": "Close",
56+
"searchByText": "Search provider"
57+
},
58+
"noResultsScreen": {
59+
"noResultsText": "No relevant results found",
60+
"suggestedQueryText": "You can try searching for",
61+
"reportMissingResultsText": "Do you think this query should have results?",
62+
"reportMissingResultsLinkText": "Click to feedback"
63+
}
64+
}
65+
}
66+
}
67+
}

docs/en/intro.md

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# App Store
6+
7+
Your application can be published to someone else's app store, or you can develop your own app store.
8+
Alternatively, you can simply place the `deeplink` link from the `metadata.json` on your app's official website, allowing users to download the app directly by visiting the website.
9+
10+
Here is an open-source app store provided, which you can fork and deploy your own app to your own store.
11+
12+
[App Store Source Code](https://github.com/BioforestChain/app-center)
13+
14+
## How to Create a Download Link
15+
16+
First, your application will package two files as follows:
17+
18+
```bash
19+
bundle
20+
├── xxxxx.dweb.zip
21+
└── metadata.json
22+
```
23+
24+
Next, you need to upload them to your app's official website (app store).
25+
Assuming I upload them to the root directory of my app's official website:
26+
27+
```bash
28+
├── https://dweb.browser.org/xxxxx.dweb.zip
29+
└── https://dweb.browser.org/metadata.json
30+
```
31+
32+
Then, my app's official website only needs to redirect in the following way to trigger the app download.
33+
34+
::: code-group
35+
36+
```javascript [open]
37+
window.open(`dweb://install?url=https://dweb.browser.org/metadata.json`);
38+
```
39+
40+
```html [a tag]
41+
<a href="dweb://install?url=https://dweb.browser.org/metadata.json">Click to Download</a>
42+
```
43+
44+
```javascript [href]
45+
location.href = "dweb://install?url=https://dweb.browser.org/metadata.json";
46+
```
47+
48+
:::
49+
50+
The principle for creating a download link is simple. Use the `dweb:install?url=` deep link format to construct the download link.
51+
This way, users only need to click this (link) button in the Dweb Browser app to jump to the download interface.
52+
53+
## Using QR Codes
54+
55+
You can also simply place a QR code on your official website, making it convenient for users who have already installed the Dweb Browser app to use the `deep_link` scanning feature to jump and download.
56+
57+
You only need to generate a QR code for an address similar to the one below. After scanning, users will be redirected to the app download interface.
58+
59+
```bash
60+
dweb://install?url=https://dweb.browser.org/metadata.json
61+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Deep Link
2+
3+
Deep Link is a linking technology that allows users to directly jump to specific content or pages within an application when clicking a link, rather than just opening the app's homepage.
4+
5+
Apps inside dweb-browser can also register their own deeplink links. Below are some system-level application links.
6+
7+
## `dweb://install?url=`
8+
9+
This protocol is the most commonly used, registered by the `jmm.browser.dweb` module, which is responsible for app installation.
10+
11+
```bash
12+
dweb://install?url=http://127.0.0.1:8097/metadata.json
13+
```
14+
15+
## `dweb://open?app_id=xxx.dweb`
16+
17+
This interface can open an app by passing the `app_id` (mmid), registered by the core `dns.std.dweb` module.
18+
19+
```bash
20+
dweb://open?app_id=bfchain.dweb
21+
```
22+
23+
## `dweb://search?q=xxx`
24+
25+
Search within the browser, registered by the `web.browser.dweb` module.
26+
27+
```bash
28+
dweb://search?q=wireshark
29+
```
30+
31+
## `dweb://openinbrowser?url=link&target=_blank`
32+
33+
Open a page in the internal browser of dweb-browser. The target parameter allows passing `_self`, `_blank`, `_system`. `_blank` is the default value.
34+
Also registered by `web.browser.dweb`.
35+
36+
```bash
37+
dweb://openinbrowser?url=https://google.com&target=_blank
38+
```
39+
40+
## `dweb://shortcutopen?mmid=xxx.dweb&data=xxx`
41+
42+
Quick entry protocol, which can send some data to the shortcut entry of an app to perform certain actions. Registered by the `shortcut.sys.dweb` module.
43+
44+
```bash
45+
dweb://shortcutopen?mmid=bfchain.dweb&data=1' order by 3 --+
46+
```

0 commit comments

Comments
 (0)