ant-design / antd-style

css-in-js library with antd v5 token system
https://ant-design.github.io/antd-style/
MIT License
187 stars 29 forks source link

:memo: docs: add English documents with lobe-i18n #124

Closed arvinxx closed 7 months ago

arvinxx commented 7 months ago

使用 lobe-i18n 实现文档的一键英文翻译。效果如下:

https://github.com/ant-design/antd-style/assets/28616219/a6803fd3-0502-4337-bb7b-78c20be63af3

操作路径:

  1. 安装依赖 @lobehub/i18n-cli:
pnpm i -D @lobehub/i18n-cli
  1. 添加 .i18nrc.js 配置文件:
/**
 * @type {import("@lobehub/i18n-cli").Config}
 */
module.exports = {
  markdown: {
    entry: ['docs/**/**.md', './README.zh-CN.md'],
    entryLocale: 'zh-CN',
    entryExtension: '.zh-CN.md',
    outputLocales: ['en-US'],
  },
  modelName: 'gpt-3.5-turbo-1106',
};
  1. 执行 lobe-i18n --option 配置 OpenAI API Key:
image
  1. 执行 lobe-i18n md 即可翻译匹配到的全量 md 文件:
image
  1. (可选)可以在 scripts 字段中添加执行脚本:
    "i18n-md": "lobe-i18n md",
github-actions[bot] commented 7 months ago

🎊 PR Preview 1f3f99ef296a039eec6a218cfd30cf9808d62c1d has been successfully built and deployed to https://ant-design-antd-style-preview-pr-124.surge.sh

:clock1: Build time: 105.795s

🤖 By surge-preview

arvinxx commented 7 months ago

补充一键添加 .zh-CN suffix 的 macOS shell 脚本:

find ./docs -type f -name "*.md" -exec sh -c 'for file; do mv "$file" "${file%.md}.zh-CN.md"; done' sh {} +

命令解释:

使用这个命令,你可以在不安装任何额外软件包的情况下,在 macOS 上批量重命名 docs 文件夹下的 .md 文件。在执行任何批量文件操作之前,确保你有备份,以防不测。

github-actions[bot] commented 6 months ago

:tada: This PR is included in version 3.6.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: