1.0.2 • Published 3 years ago

i18n-youdao-translate v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

i18n-youdao-translate

This package uses i18next-scanner to extract translation keys/values, and merges them into i18n resource files, then translates the value in the specified file.

Because the length of a single request to Youdao translation is controlled within 5000 characters, so the main translation process is to combine multiple consecutive translation values by using a separater that add up to 5000 characters, then split the translated values by the separater. Therefore, this may have context problems.

这个包使用 i18next-scanner 提取翻译键/值,并将它们合并到 i18n 资源文件中,然后翻译指定文件中的值。

因为对有道翻译的单个请求长度控制在5000个字符以内,所以这主要的翻译过程是使用一个分隔符将多个连续的翻译值组合起来,加起来最多5000个字符,然后由分隔符拆分翻译值。 因此,这可能存在上下文问题。

Usage

Example

Create a config file youdao-translate.config.js in the root directory.

const path = require('path');

module.exports = {
    translateFilePath: [path.resolve(__dirname, './app/i18n/locales/zh_HK/translation.json')], // the array of resource files that you want to translate
    appId: 'your_app_id', // your app ID from youdou (https://ai.youdao.com)
    secretKey: 'your_app_secret_key', // your secret key from youdao (https://ai.youdao.com)
    from: ['zh'], // the array of curesponding input languages
    to: ['en'], // the array of curesponding target language
    separater: ';||||', // (Optional) the sepatater used to separate the translated string, default ';||||'
};
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago