This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-website.git
The following commit(s) were added to refs/heads/main by this push:
new 6c85a32a2 docs(plugins): update documentation for i18n files
6c85a32a2 is described below
commit 6c85a32a220bd88007649e6388635e29ef8099b2
Author: Sonui <[email protected]>
AuthorDate: Mon Aug 12 13:31:11 2024 +0800
docs(plugins): update documentation for i18n files
---
docs/development/plugins/plugin-translation.md | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/docs/development/plugins/plugin-translation.md
b/docs/development/plugins/plugin-translation.md
index 593af2c7a..f291522ac 100644
--- a/docs/development/plugins/plugin-translation.md
+++ b/docs/development/plugins/plugin-translation.md
@@ -78,7 +78,7 @@ plugin:
- The `plugin` is the root key of the translation file.
- The `github_connector` is the name of the plugin.
-- The `backend` is translation for the backend. The end of key like `other` is
just for [go-i18n](https://github.com/nicksnyder/go-i18n) to recognize the
translation file.
+- The `backend` is translation for the backend. The end of key like `other` is
just for [go-i18n](https://github.com/nicksnyder/go-i18n) to recognize the
translation file.
- The `ui` is translation for the frontend.
You can use the key like `plugin.github_connector.backend.name` or
`plugin.github_connector.ui.login.title` for translation.
@@ -101,7 +101,7 @@ const (
The `i18n.go` file is used to store the key of the translation file.
-Finally, the directory structure of the plugin is as follows:
+The directory structure of the plugin is as follows:
```bash
.
@@ -115,6 +115,20 @@ Finally, the directory structure of the plugin is as
follows:
└── zh_CN.yaml
```
+Finally, execute the following bash shell command to merge the plugin i18n
files into the answer i18n runtime data.
+
+You can replace the environment variables with your own data or define them as
needed.
+
+```bash
+go run ./cmd/answer/main.go i18n -s $PLUGIN_PATH -t $ANSWER_DATA_PATH
+```
+
+Example:
+
+```bash
+go run ./cmd/answer/main.go i18n -s ../incubator-answer-plugins/ -t
./answer-data/i18n/
+```
+
## Backend translation
You just need to return `Translator` structure with the key of the translation
file.