Skip to content

Commit

Permalink
Add documentation for translating Easyict (#230)
Browse files Browse the repository at this point in the history
* docs: add translation guide

* docs: update translation guide

* Update How-to-translate-Easydict.md

* docs: wrap up translation doc

* docs: update header
  • Loading branch information
Jerry23011 authored Nov 19, 2023
1 parent b327c95 commit 6c60d70
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
- [类似开源项目](#类似开源项目)
- [初衷](#初衷)
- [贡献指南](#贡献指南)
- [本地化](#本地化)
- [致谢](#致谢)
- [声明](#声明)
- [赞助支持](#赞助支持)
Expand Down Expand Up @@ -624,6 +625,9 @@ Easydict 有一些应用内快捷键,方便你在使用过程中更加高效

如果 PR 是关于某个新功能或者涉及 UI 等较大的变动,建议先开个 issue 讨论一下,避免功能重复或者冲突。

### 本地化
我们正在寻找能为 Easydict 提供翻译的 contributor,如果你想为 Easydict 提供翻译,请参考[这篇文档](/docs/How-to-translate-Easydict-zh)

## Star History

<a href="https://star-history.com/#tisfeng/easydict&Date">
Expand Down
4 changes: 4 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
- [Similar Open Source Projects](#similar-open-source-projects)
- [Motivation](#motivation)
- [Contributor Guide](#contributor-guide)
- [Localization](#localization)
- [Acknowledgements](#acknowledgements)
- [Statement](#statement)
- [Sponsor](#sponsor)
Expand Down Expand Up @@ -625,6 +626,9 @@ If the PR is a bug fix or feature implementation for an existing issue, please s

If the PR is about a new feature or involves major changes to the UI, it is recommended to open an issue for discussion first to avoid duplicate or conflicting features.

### Localization
We are actively looking for contributors who can translate Easydict into your own languages. If you are interested, please refer to this [documentation](/docs/How-to-translate-Easydict-en) for details.

## Star History

<a href="https://star-history.com/#tisfeng/easydict&Date">
Expand Down
30 changes: 30 additions & 0 deletions docs/How-to-translate-Easydict-en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Getting Started
We are using String Catalog in Xcode to manage translations for Easydict, so the following steps are what you need to get started on localizing the app.
### Install Xcode 15+
You can install Xcode from the [Mac App Store](https://apps.apple.com/app/xcode/id497799835) or its beta versions on [Apple Developer](https://developer.apple.com/xcode/resources/).
### Cloning and building the project
1. Use git to clone the project from GitHub to your Mac. You can do this by using the [git command line tool](https://docs.github.com/en/get-started/getting-started-with-git) or [GitHub Desktop](https://desktop.github.com).
2. Make sure you are on the [dev](https://github.com/tisfeng/Easydict/tree/dev) branch, this is where development takes place.
3. Open the project and build it, detailed instructions on how to build the project can be found [here](/README_EN.md#developer-build).
### Add your language to String Catalog
Now you can start adding your own language!
1. Navigate to `Easydict -> Easydict -> App -> Localizable.xcstrings`. Also Expand `Main.storyboard` to find `Main.xcstrings (Strings)` These two `.xcstrings` files are what you are going to work on.
2. Click the `Localizable.xcstrings` file first and click the `+` button to find a list of available options. If you don't see the language you want to localize in the list (e.g. Canadian English). Scroll all the way down to the bottom of the menu to find `More Languages`.
3. After you add a language, you can start translating. Don't forget to translate the strings in `Main.xcstring (Strings)`😉
### Previewing your translations
After you are done with your translations, it's nice to run the app and preview them to look for rooms for improvements. You can set the app language to the one that you did with a simple few clicks.
1. Find the Easydict icon on the top toolbar of Xcode and click on it
2. Click on `Edit Scheme...`
3. Select the `RUN` tab on the left sidebar and go to `Options`
4. Scroll down and find `App Language`, then choose the one you localized for
5. Close the tab and use ⌘R to run the app and see your translations
### Pushing your changes to GitHub
After you finish checking your localization, it's time to push the changes to GitHub and start a pull request.
- [Start a Pull Request](https://docs.github.com/en/pull-requests).
- Remember to set the merge target to the `dev` branch
Now you can wait for a maintainer's review and get your translations adopted in the next Easydict version.
### Additional Resources
- [Localization - Apple Developer](https://developer.apple.com/documentation/Xcode/localization)
- [Localizing and varying text with a string catalog - Apple Developer](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog)
- [Discover String Catalogs - WWDC23 Videos](https://developer.apple.com/videos/play/wwdc2023/10155)
- [Apple Localization Glossaries](https://applelocalization.com)
30 changes: 30 additions & 0 deletions docs/How-to-translate-Easydict-zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 开始翻译
Easydict 的翻译是通过 Xcode 中的 String Catalog 管理的,下面是翻译 Easydict 的详细步骤
### 安装 Xcode 15+
可以从 [Mac App Store](https://apps.apple.com/app/xcode/id497799835) 安装Xcode,或者从 [Apple Developer](https://developer.apple.com/xcode/resources/) 获取 Beta 版本。
### 克隆和构建项目
1. 使用 git 将项目从 GitHub 克隆到本地,这里可以使用 [git 命令行工具](https://docs.github.com/en/get-started/getting-started-with-git)[GitHub Desktop](https://desktop.github.com)
2. 切换到 [dev](https://github.com/tisfeng/Easydict/tree/dev) 分支
3. 打开项目并构建,有关如何构建项目的详细说明在[这里](/README.md#developer-build)
### 添加语言到String Catalog
现在可以添加新的语言了!
1. 找到 `Easydict -> Easydict -> App -> Localizable.xcstrings`。同时展开 `Main.storyboard` 然后找到 `Main.xcstrings (Strings)`。这两个 `.xcstrings` 是翻译要用的
2. 首先打开 `Localizable.xcstrings` 文件,然后点`+`按钮添加语言,如果找不到要做翻译的语言(例如 Canadian English),滚动到菜单底部,打开二级菜单 `More Languages`
3. 添加语言后就可以开始翻译了。不要忘记翻译 `Main.xcstring (Strings)` 中的字符串😉
### 预览翻译
在完成翻译后可以跑一下 Easydict 做检查。
1. 在 Xcode 顶部工具栏上找到 Easydict 图标,然后点击它
2. 点击 `Edit Scheme...`
3. 在侧边栏中选择 `RUN`,然后转到 `Options`
4. 向下滚动找到 `App Language`,然后选择要检查的语言
5. 关闭选项卡,然后使用快捷键 ⌘R 运行 Easydict 并检查翻译
### 将更改 push 到 GitHub
在完成本地化检查后就可以将更改 push 到 GitHub 并发起拉取请求了。
- [发起拉取请求](https://docs.github.com/zh/pull-requests)
- 记得将合并目标设置为`dev`分支
最后等待 review 完成就可以合并到主仓库啦,下一次发版的时候就能看到最新的翻译啦!
### 其他资源
- [Localization - Apple Developer](https://developer.apple.com/documentation/Xcode/localization)
- [Localizing and varying text with a string catalog - Apple Developer](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog)
- [Discover String Catalogs - WWDC23 Videos](https://developer.apple.com/videos/play/wwdc2023/10155)
- [Apple 本地化术语表](https://applelocalization.com)

0 comments on commit 6c60d70

Please sign in to comment.