{"id":23395599,"url":"https://github.com/hugo-fixit/cmpt-translate","last_synced_at":"2026-03-02T05:07:52.392Z","repository":{"id":266046779,"uuid":"897186033","full_name":"hugo-fixit/cmpt-translate","owner":"hugo-fixit","description":"🌐 A component for site automatic translation.","archived":false,"fork":false,"pushed_at":"2025-04-07T03:06:47.000Z","size":646,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T03:31:47.859Z","etag":null,"topics":["hugo","hugo-fixit","i18n","theme-component","translatejs"],"latest_commit_sha":null,"homepage":"https://fixit.lruihao.cn?lang=chinese_traditional","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugo-fixit.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/Lruihao"]}},"created_at":"2024-12-02T07:29:57.000Z","updated_at":"2025-04-07T03:06:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"926b4a39-deae-45a6-8fd0-4939d1c0225f","html_url":"https://github.com/hugo-fixit/cmpt-translate","commit_stats":null,"previous_names":["hugo-fixit/cmpt-translate"],"tags_count":18,"template":false,"template_full_name":"hugo-fixit/component-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugo-fixit%2Fcmpt-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugo-fixit%2Fcmpt-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugo-fixit%2Fcmpt-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugo-fixit%2Fcmpt-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugo-fixit","download_url":"https://codeload.github.com/hugo-fixit/cmpt-translate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248413657,"owners_count":21099341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hugo","hugo-fixit","i18n","theme-component","translatejs"],"created_at":"2024-12-22T07:16:31.600Z","updated_at":"2026-01-06T05:14:04.108Z","avatar_url":"https://github.com/hugo-fixit.png","language":"TypeScript","funding_links":["https://paypal.me/Lruihao"],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable-file MD033 MD041 --\u003e\n\u003ch1 align=\"center\"\u003eAuto Translate | FixIt\u003c/h1\u003e\n\n![auto-translate](https://github.com/user-attachments/assets/10ab49bb-973f-4630-9a79-9639783bab06)\n\n\u003cdiv align=\"center\" class=\"ignore\"\u003e\n  \u003cp\u003eA component for website automatic translation base on \u003ca href=\"https://github.com/xnx3/translate\"\u003etranslate.js\u003c/a\u003e.\u003c/p\u003e\n  \u003ca href=\"/README.md\"\u003e简体中文\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/zh-cn/ecosystem/hugo-fixit/cmpt-translate/?lang=chinese_traditional\"\u003e繁體中文\u003c/a\u003e |\n  English |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=french\"\u003eFrançais\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=russian\"\u003eРусский язык\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=spanish\"\u003eEspañol\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=hindi\"\u003eहिन्दी\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=deutsch\"\u003edeutsch\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=korean\"\u003e한국어\u003c/a\u003e |\n  \u003ca href=\"https://fixit.lruihao.cn/ecosystem/hugo-fixit/cmpt-translate/?lang=japanese\"\u003eしろうと\u003c/a\u003e\n\u003c/div\u003e\n\n## Demo\n\nWhether the original site is multilingual or single-language, you can add automatic translation feature through this component.\n\n- Multilingual Hugo site: [fixit.lruihao.cn](https://fixit.lruihao.cn)\n- Single-language Hugo site: [lruihao.cn](https://lruihao.cn)\n\nSwitch the configured translation language in the upper right corner of the website, or add the `?lang=` parameter to the URL to specify any [supported translation language](https://api.translate.zvo.cn/language.json). e.g. `?lang=korean`.\n\n## Features\n\n\u003e Daily translation characters **2 million**!\\\n\u003e _No language configuration file, no API Key, SEO friendly!_\n\n- [x] Support automatic translation of the entire page\n- [x] Support specifying the translation language\n- [x] Support optional translation services\n- [x] Support ignoring translation elements\n- [x] Support ignoring selectors\n- [x] Support ignoring keyword translation\n- [x] Support detecting local languages\n- [x] Support custom translation terms\n- [x] Support CDN\n- [x] Support [Enterprise Translation Channel](#enterprise) *\n\n## Requirements\n\n- Hugo v0.146.0 or later.\n- FixIt v0.4.0 or later.\n\n## Install Component\n\nThe installation method is the same as [installing a theme](https://fixit.lruihao.cn/documentation/installation/). There are several ways to install, choose one, Here are two mainstream ways.\n\n### Install as Hugo Module\n\nFirst make sure that your project itself is a [Hugo module](https://gohugo.io/hugo-modules/use-modules/#initialize-a-new-module).\n\nThen add this theme component to your `hugo.toml` configuration file:\n\n```toml\n[module]\n\n[[module.imports]]\npath = \"github.com/hugo-fixit/FixIt\"\n\n[[module.imports]]\npath = \"github.com/hugo-fixit/cmpt-translate\"\n```\n\nOn the first start of Hugo it will download the required files.\n\nTo update to the latest version of the module run:\n\n```bash\nhugo mod get -u\nhugo mod tidy\n```\n\n### Install as Git Submodule\n\nClone [FixIt](https://github.com/hugo-fixit) and this git repository into your theme folder and add it as submodules of your website directory.\n\n```bash\ngit submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt\ngit submodule add https://github.com/hugo-fixit/cmpt-translate.git themes/cmpt-translate\n```\n\nNext edit `hugo.toml` of your project and add this theme component to your themes:\n\n```toml\ntheme = [\n  \"FixIt\",\n  \"cmpt-translate\"\n]\n```\n\n## Configuration\n\nIn order to Inject the partial `cmpt-translate.html` into the `custom-assets` through the [custom block](https://fixit.lruihao.cn/references/blocks/) opened by the FixIt theme, you need to fill in the following necessary configurations:\n\n```toml\n[params]\n\n[params.customPartials]\n# ... other partials\nmenuDesktop = [ \"inject/translate-menu-desktop.html\" ]\nmenuMobile = [ \"inject/translate-menu-mobile.html\" ]\nassets = [ \"inject/cmpt-translate.html\" ]\n# ... other partials\n```\n\nIn addition, you can customize the translated language through the following configuration:\n\n```toml\n[languages]\n\n[languages.en]\nlanguageCode = \"en\"\nlanguageName = \"English\"\n\n[params]\n\n[params.autoTranslate]\nenable = true\nservice = 'client.edge'\nlanguages = []\nignoreID = []\nignoreClass = []\nignoreTag = []\ndetectLocalLanguage = false\ncdn = \"\"\n```\n\n- `enable`: Whether to enable automatic translation.\n- `service`: The translation service provider, optional values are `client.edge` and `translate.service`, see: [Translation Service Provider](https://translate.zvo.cn/43086.html).\n- `languages`: List of language ID to translate to, e.g. `[\"english\", \"chinese_simplified\", \"chinese_traditional\", ...]`, see the full language list: [Full Language List](https://api.translate.zvo.cn/language.json).\n- `ignoreID`: Element IDs that needs to be ignored for translation, e.g. `[\"comment\", ...]`\n- `ignoreClass`: Class names that need to be ignored for translation, e.g. `[\"post-category\", ...]`\n- `ignoreTag`: Tag names that need to be ignored for translation, e.g. `[\"title\", ...]`\n- `ignoreText`: Texts that needs to be ignored for translation, e.g. `[\"FixIt\", \"Lruihao\", ...]`\n- `detectLocalLanguage`: Whether to detect the local language\n- `cdn`: CDN of translate.js, e.g. `https://cdn.jsdelivr.net/npm/i18n-jsautotranslate@latest`\n- `enterprise`: Whether to use the [enterprise translation channel](#enterprise)\n\n\u003e [!NOTE]\n\u003e To avoid translation language acquisition failure, even if your site itself is single-language, you need to configure `languageCode` and `languageName`, for example:\n\u003e\n\u003e ```toml\n\u003e [languages]\n\u003e\n\u003e [languages.zh-cn]\n\u003e languageCode = \"en\"\n\u003e languageName = \"English\"\n\u003e ```\n\n## Front Matter\n\n```yaml\nautoTranslate:\n  local: ''\n  fromLanguages: []\n  onlyLocalLang: false\n```\n\n- `local`: `String` Used to specify the local language of the current page, e.g. `local: english`.\n\n    The default local language is the same as the Hugo site configuration. If the actual language of a page is different from the site configuration, you can specify it through the `local` parameter.\n\n- `fromLanguages`: `Array` type, used to specify whether the languages in the current page content need to be translated.\n\n    For example: the webpage itself is in Chinese, but there are other languages in the content. You can specify the language to be translated, for example:\n\n    ```yaml\n    fromLanguages:\n      - chinese_simplified\n      - chinese_traditional\n    ```\n\n- `onlyLocalLang`: `Boolean` type, used to specify whether to translate only the local language of the current page, the default is `false`.\n\n    For example: the webpage itself is in Chinese, but there are summary references in other languages in the content. Set `onlyLocalLang: true` to translate only Chinese.\n\n## Custom Translation Terms\n\nCreate a `nomenclature.yml` file in the `data` folder of your project directory, and then add custom translation terms, for example:\n\n```yaml\n- from: english\n  to: chinese_simplified\n  properties:\n    Hello: 你好\n    World: 世界\n- from: english\n  to: french\n  properties:\n    Hello: Bonjour\n    World: Monde\n```\n\n\u003c!-- markdownlint-disable-next-line MD033 --\u003e\n## Enterprise Translation Channel \u003ca id=\"enterprise\"\u003e\u003c/a\u003e\n\n\u003e Enterprise-level stable translation channel, open only to **paying users**.\\\n\u003e **Experience quota**: There is a daily experience quota of 50,000 characters, and the excess will no longer be translated!\n\nSet `enterprise = true` in the configuration to enable the enterprise translation channel. The [enterprise translation channel](https://translate.zvo.cn/4087.html) has the following advantages over the ordinary translation channel:\n\n| Service                      | Open source translation channel | Enterprise translation channel |\n| :--------------------------- | :------------------------------ | :----------------------------- |\n| Server cache layers          | 1 layer (file cache)            | 1 layer (memory + file cache)  |\n| Translation response speed   | 1.5~5 seconds                   | 0.8~1.5 seconds                |\n| Translation server           | 1                               | \u003e=3                            |\n| Network nodes                | 2                               | \u003e=4                            |\n| Translation channel          | Manual setting                  | Automatically match the best   |\n| Domestic cache nodes         | None                            | Yes                            |\n| Daily translation characters | 2 million                       | 50 million                     |\n\n### Sponsorship fee\n\nConsidering that most of the FixIt ecosystem audiences are individual users, I ([@Lruihao](https://github.com/Lruihao)) will use sponsorship income as a subsidy in my **personal name**.\n\n\u003e [!TIP]\n\u003e **Subsidy price for FixIt project**: **¥10** ~~_¥50_~~ / domain / month\\\n\u003e _Automatically disabled upon expiration, requiring re-sponsorship renewal!_\n\nThose who meet the following requirements can contact me for free to open an enterprise translation channel:\n\n- [translate.js](https://github.com/xnx3/translate) and related ecological product developers\n- [FixIt](https://github.com/hugo-fixit/FixIt) and related ecological product developers\n\nIn addition, each member of the [Hugo FixIt Planet](https://wx.zsxq.com/group/88888281181442?group_id=88888281181442\u0026coupon_code=ks2qf5zd\u0026inviter_id=15442515242512\u0026inviter_sid=e15da0zzz4\u0026keyword=BQcpe\u0026type=group) will be given a subsidy of **6 months of service / year**.\n\n### Sponsorship method\n\n- [WeChat](https://lruihao.cn/images/wechatpay.jpg)\n- [Alipay](https://lruihao.cn/images/alipay.jpg)\n\nChoose the donation amount, and then remark `AutoTranslate: your domain name` in the message.\n\nContact the author through the following methods:\n\n- Email: `1024#lruihao.cn` (replace `#` with `@`)\n- WeChat: [Follow the official account and reply \"Cell\" to get the author's WeChat](https://lruihao.cn/images/qr-wx-mp_s.webp)\n\n## Acknowledgements\n\n[translate.js](https://github.com/xnx3/translate) provides technical support and sponsors [Enterprise Translation Channel](https://translate.zvo.cn/4087.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugo-fixit%2Fcmpt-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugo-fixit%2Fcmpt-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugo-fixit%2Fcmpt-translate/lists"}