tony84727 / diplomat

Tool, code generator for internationalization.
MIT License
1 stars 0 forks source link
chinese-conversion code-generator i18n tool

diplomat

Build Status GoDoc

:construction: Alpha! The API and configuration file format are likely changed.

Usage

build diplomat/cmd package cd cmd && go build

Goal

  1. Generate translation module
  2. Auto chinese convertion (simplied <=> tranditional)

Translation file format (see testdata/diplomat.yaml)

version: "1"
preprocessors:
- type: chinese
  options:
    mode: t2s
    from: zh-TW
    to: zh-CN
- type: copy
  options:
    from: en
    to: fr
outputs:
  - selectors:
      - admin
      - manage
    templates:
      - type: js-object
        options:
          filename: "control-panel.js"

Above configuration will generate a file:

// control-panel.js
// DO NOT EDIT. generated by diplomat (https://github.com/tony84727/diplomat).
export default {
"admin.admin.zh-TW": "管理員","admin.admin.en": "Admin","admin.admin.zh-CN": "管理员","admin.admin.fr": "Admin","admin.message.hello.zh-TW": "您好","admin.message.hello.en": "Hello!","admin.message.hello.zh-CN": "您好","admin.message.hello.fr": "Hello!",
}