mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 03:40:12 +08:00
feat(website): add translation progress (#2113)
* feat(website): add translation progress * feat(website): add French and Portuguese to language list Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
parent
91de3ab0c5
commit
51a12131a4
@ -4,258 +4,271 @@
|
|||||||
const lightCodeTheme = require("prism-react-renderer/themes/github");
|
const lightCodeTheme = require("prism-react-renderer/themes/github");
|
||||||
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
|
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
|
||||||
|
|
||||||
/** @type {import('@docusaurus/types').Config} */
|
const { getTranslationProgress } = require("./src/api/crowdin.js");
|
||||||
const config = {
|
|
||||||
title: "Wails",
|
|
||||||
tagline: "",
|
|
||||||
url: "https://wails.io",
|
|
||||||
baseUrl: "/",
|
|
||||||
onBrokenLinks: "warn",
|
|
||||||
onBrokenMarkdownLinks: "warn",
|
|
||||||
favicon: "img/favicon.ico",
|
|
||||||
organizationName: "wailsapp",
|
|
||||||
projectName: "wails",
|
|
||||||
|
|
||||||
webpack: {
|
module.exports = async function configCreatorAsync() {
|
||||||
jsLoader: (isServer) => ({
|
const translationProgress = await getTranslationProgress();
|
||||||
loader: require.resolve('swc-loader'),
|
return {
|
||||||
options: {
|
title: "Wails",
|
||||||
jsc: {
|
tagline: "",
|
||||||
parser: {
|
url: "https://wails.io",
|
||||||
syntax: 'typescript',
|
baseUrl: "/",
|
||||||
tsx: true,
|
onBrokenLinks: "warn",
|
||||||
|
onBrokenMarkdownLinks: "warn",
|
||||||
|
favicon: "img/favicon.ico",
|
||||||
|
organizationName: "wailsapp",
|
||||||
|
projectName: "wails",
|
||||||
|
|
||||||
|
webpack: {
|
||||||
|
jsLoader: (isServer) => ({
|
||||||
|
loader: require.resolve("swc-loader"),
|
||||||
|
options: {
|
||||||
|
jsc: {
|
||||||
|
parser: {
|
||||||
|
syntax: "typescript",
|
||||||
|
tsx: true,
|
||||||
|
},
|
||||||
|
target: "es2017",
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
type: isServer ? "commonjs" : "es6",
|
||||||
},
|
},
|
||||||
target: 'es2017',
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
type: isServer ? 'commonjs' : 'es6',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
i18n: {
|
|
||||||
defaultLocale: "en",
|
|
||||||
locales: ["en", "zh-Hans", "ja"],
|
|
||||||
localeConfigs: {
|
|
||||||
en: {
|
|
||||||
label: "English",
|
|
||||||
direction: "ltr",
|
|
||||||
htmlLang: "en-US",
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
label: "简体中文",
|
|
||||||
direction: "ltr",
|
|
||||||
htmlLang: "zh-Hans",
|
|
||||||
},
|
|
||||||
ja: {
|
|
||||||
label: "日本語",
|
|
||||||
direction: "ltr",
|
|
||||||
htmlLang: "ja-JP",
|
|
||||||
},
|
|
||||||
ru: {
|
|
||||||
label: "Русский",
|
|
||||||
direction: "ltr",
|
|
||||||
htmlLang: "ru-RU",
|
|
||||||
},
|
|
||||||
ko: {
|
|
||||||
label: "한국어",
|
|
||||||
direction: "ltr",
|
|
||||||
htmlLang: "ko-KR",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
"classic",
|
|
||||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
|
||||||
({
|
|
||||||
docs: {
|
|
||||||
sidebarPath: require.resolve("./sidebars.js"),
|
|
||||||
// Please change this to your repo.
|
|
||||||
editUrl: "https://github.com/wailsapp/wails/edit/master/website",
|
|
||||||
},
|
|
||||||
blog: {
|
|
||||||
showReadingTime: true,
|
|
||||||
// Please change this to your repo.
|
|
||||||
editUrl: "https://github.com/wailsapp/wails/edit/master/website/blog",
|
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
customCss: [
|
|
||||||
require.resolve("./src/css/custom.css"),
|
|
||||||
require.resolve("./src/css/carousel.css"),
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
},
|
||||||
|
i18n: {
|
||||||
|
defaultLocale: "en",
|
||||||
|
locales: ["en", "zh-Hans", "ja", "ru", "ko", "fr", "pt"],
|
||||||
|
localeConfigs: {
|
||||||
|
en: {
|
||||||
|
label: "English",
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "en-US",
|
||||||
|
},
|
||||||
|
"zh-Hans": {
|
||||||
|
label: `简体中文 (${translationProgress["zh-CN"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "zh-Hans",
|
||||||
|
},
|
||||||
|
ja: {
|
||||||
|
label: `日本語 (${translationProgress["ja"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "ja-JP",
|
||||||
|
},
|
||||||
|
ru: {
|
||||||
|
label: `Русский (${translationProgress["ru"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "ru-RU",
|
||||||
|
},
|
||||||
|
ko: {
|
||||||
|
label: `한국어 (${translationProgress["ko"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "ko-KR",
|
||||||
|
},
|
||||||
|
fr: {
|
||||||
|
label: `Français (${translationProgress["fr"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "fr",
|
||||||
|
},
|
||||||
|
pt: {
|
||||||
|
label: `Português (${translationProgress["pt-PT"]}%)`,
|
||||||
|
direction: "ltr",
|
||||||
|
htmlLang: "pt-PT",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
"classic",
|
||||||
|
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||||
|
({
|
||||||
|
docs: {
|
||||||
|
sidebarPath: require.resolve("./sidebars.js"),
|
||||||
|
// Please change this to your repo.
|
||||||
|
editUrl: "https://github.com/wailsapp/wails/edit/master/website",
|
||||||
|
},
|
||||||
|
blog: {
|
||||||
|
showReadingTime: true,
|
||||||
|
// Please change this to your repo.
|
||||||
|
editUrl:
|
||||||
|
"https://github.com/wailsapp/wails/edit/master/website/blog",
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
customCss: [
|
||||||
|
require.resolve("./src/css/custom.css"),
|
||||||
|
require.resolve("./src/css/carousel.css"),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
themeConfig:
|
themeConfig:
|
||||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||||
({
|
({
|
||||||
navbar: {
|
navbar: {
|
||||||
title: "",
|
title: "",
|
||||||
logo: {
|
logo: {
|
||||||
alt: "Wails Logo",
|
alt: "Wails Logo",
|
||||||
src: "img/wails-logo-horizontal.svg",
|
src: "img/wails-logo-horizontal.svg",
|
||||||
srcDark: "img/wails-logo-horizontal-dark.svg",
|
srcDark: "img/wails-logo-horizontal-dark.svg",
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: "docsVersionDropdown", //version
|
||||||
|
position: "left",
|
||||||
|
dropdownActiveClassDisabled: true,
|
||||||
|
dropdownItemsAfter: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "https://github.com/sponsors/leaanthony",
|
||||||
|
label: "Sponsor",
|
||||||
|
position: "left",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "doc",
|
||||||
|
docId: "introduction",
|
||||||
|
position: "right",
|
||||||
|
label: "Docs",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "/blog",
|
||||||
|
label: "Blog",
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "dropdown",
|
||||||
|
label: "About",
|
||||||
|
position: "right",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
to: "/faq",
|
||||||
|
label: "FAQ",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "/changelog",
|
||||||
|
label: "Changelog",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "/community-guide",
|
||||||
|
label: "Community Guide",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "/coc",
|
||||||
|
label: "Code of Conduct",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "/credits",
|
||||||
|
label: "Credits",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "localeDropdown",
|
||||||
|
position: "right",
|
||||||
|
dropdownItemsAfter: [
|
||||||
|
{
|
||||||
|
to: "/community-guide#documenting",
|
||||||
|
label: "Help Us Translate ❤",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://github.com/wailsapp/wails",
|
||||||
|
label: "GitHub",
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "search",
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
items: [
|
footer: {
|
||||||
{
|
style: "dark",
|
||||||
type: "docsVersionDropdown", //version
|
logo: {
|
||||||
position: "left",
|
alt: "Wails Logo",
|
||||||
dropdownActiveClassDisabled: true,
|
src: "img/wails-logo-horizontal.svg",
|
||||||
dropdownItemsAfter: [],
|
srcDark: "img/wails-logo-horizontal-dark.svg",
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "https://github.com/sponsors/leaanthony",
|
|
||||||
label: "Sponsor",
|
|
||||||
position: "left",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "doc",
|
|
||||||
docId: "introduction",
|
|
||||||
position: "right",
|
|
||||||
label: "Docs",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "/blog",
|
|
||||||
label: "Blog",
|
|
||||||
position: "right",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "dropdown",
|
|
||||||
label: "About",
|
|
||||||
position: "right",
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
to: "/faq",
|
|
||||||
label: "FAQ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "/changelog",
|
|
||||||
label: "Changelog",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "/community-guide",
|
|
||||||
label: "Community Guide",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "/coc",
|
|
||||||
label: "Code of Conduct",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: "/credits",
|
|
||||||
label: "Credits",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "localeDropdown",
|
|
||||||
position: "right",
|
|
||||||
dropdownItemsAfter: [
|
|
||||||
{
|
|
||||||
to: "/community-guide#documenting",
|
|
||||||
label: "Help Us Translate ❤",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
href: "https://github.com/wailsapp/wails",
|
href: "https://github.com/wailsapp/wails",
|
||||||
label: "GitHub",
|
width: 160,
|
||||||
position: "right",
|
height: 50,
|
||||||
},
|
},
|
||||||
{
|
links: [
|
||||||
type: "search",
|
{
|
||||||
position: "right",
|
title: "Docs",
|
||||||
},
|
items: [
|
||||||
],
|
{
|
||||||
},
|
label: "Introduction",
|
||||||
footer: {
|
to: "/docs/introduction",
|
||||||
style: "dark",
|
},
|
||||||
logo: {
|
{
|
||||||
alt: "Wails Logo",
|
label: "Getting Started",
|
||||||
src: "img/wails-logo-horizontal.svg",
|
to: "/docs/gettingstarted/installation",
|
||||||
srcDark: "img/wails-logo-horizontal-dark.svg",
|
},
|
||||||
href: "https://github.com/wailsapp/wails",
|
{
|
||||||
width: 160,
|
label: "Changelog",
|
||||||
height: 50,
|
to: "/changelog",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Community",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: "Github",
|
||||||
|
href: "https://github.com/wailsapp/wails",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Twitter",
|
||||||
|
href: "https://twitter.com/wailsapp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Slack",
|
||||||
|
href: "https://gophers.slack.com/messages/CJ4P9F7MZ/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Slack invite",
|
||||||
|
href: "https://invite.slack.golangbridge.org/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "More",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: "Blog",
|
||||||
|
to: "/blog",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Awesome",
|
||||||
|
href: "https://github.com/wailsapp/awesome-wails",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
copyright: `Copyright © ${new Date().getFullYear()} Lea Anthony`,
|
||||||
},
|
},
|
||||||
links: [
|
tableOfContents: {
|
||||||
{
|
minHeadingLevel: 2,
|
||||||
title: "Docs",
|
maxHeadingLevel: 5,
|
||||||
items: [
|
},
|
||||||
{
|
prism: {
|
||||||
label: "Introduction",
|
theme: lightCodeTheme,
|
||||||
to: "/docs/introduction",
|
darkTheme: darkCodeTheme,
|
||||||
},
|
},
|
||||||
{
|
colorMode: {
|
||||||
label: "Getting Started",
|
defaultMode: "light",
|
||||||
to: "/docs/gettingstarted/installation",
|
disableSwitch: false,
|
||||||
},
|
respectPrefersColorScheme: true,
|
||||||
{
|
},
|
||||||
label: "Changelog",
|
algolia: {
|
||||||
to: "/changelog",
|
appId: "AWTCNFZ4FF",
|
||||||
},
|
apiKey: "a6c0adbe611ee2535f3da5e8fd7b2200",
|
||||||
],
|
indexName: "wails",
|
||||||
},
|
contextualSearch: true,
|
||||||
{
|
},
|
||||||
title: "Community",
|
}),
|
||||||
items: [
|
};
|
||||||
{
|
|
||||||
label: "Github",
|
|
||||||
href: "https://github.com/wailsapp/wails",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Twitter",
|
|
||||||
href: "https://twitter.com/wailsapp",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Slack",
|
|
||||||
href: "https://gophers.slack.com/messages/CJ4P9F7MZ/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Slack invite",
|
|
||||||
href: "https://invite.slack.golangbridge.org/",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "More",
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: "Blog",
|
|
||||||
to: "/blog",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Awesome",
|
|
||||||
href: "https://github.com/wailsapp/awesome-wails",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
copyright: `Copyright © ${new Date().getFullYear()} Lea Anthony`,
|
|
||||||
},
|
|
||||||
tableOfContents: {
|
|
||||||
minHeadingLevel: 2,
|
|
||||||
maxHeadingLevel: 5,
|
|
||||||
},
|
|
||||||
prism: {
|
|
||||||
theme: lightCodeTheme,
|
|
||||||
darkTheme: darkCodeTheme,
|
|
||||||
},
|
|
||||||
colorMode: {
|
|
||||||
defaultMode: "light",
|
|
||||||
disableSwitch: false,
|
|
||||||
respectPrefersColorScheme: true,
|
|
||||||
},
|
|
||||||
algolia: {
|
|
||||||
appId: "AWTCNFZ4FF",
|
|
||||||
apiKey: "a6c0adbe611ee2535f3da5e8fd7b2200",
|
|
||||||
indexName: "wails",
|
|
||||||
contextualSearch: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download"
|
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@crowdin/crowdin-api-client": "^1.19.2",
|
||||||
"@docusaurus/core": "^2.1.0",
|
"@docusaurus/core": "^2.1.0",
|
||||||
"@docusaurus/preset-classic": "^2.1.0",
|
"@docusaurus/preset-classic": "^2.1.0",
|
||||||
"@docusaurus/theme-search-algolia": "^2.1.0",
|
"@docusaurus/theme-search-algolia": "^2.1.0",
|
||||||
|
File diff suppressed because it is too large
Load Diff
22
website/src/api/crowdin.js
Normal file
22
website/src/api/crowdin.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const crowdin = require("@crowdin/crowdin-api-client");
|
||||||
|
|
||||||
|
// initialization of crowdin client
|
||||||
|
const { translationStatusApi } = new crowdin.default({
|
||||||
|
token: process.env.CROWDIN_PERSONAL_TOKEN,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getTranslationProgress() {
|
||||||
|
let translationProgress = {};
|
||||||
|
|
||||||
|
await translationStatusApi.getProjectProgress(531392).then((res) => {
|
||||||
|
for (const item of res.data) {
|
||||||
|
translationProgress[item.data.languageId] = item.data.approvalProgress;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return translationProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getTranslationProgress,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user