Skip to content

tony84727/diplomat

Repository files navigation

diplomat

Build Status GoDoc

🚧 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!",
}

About

Tool, code generator for internationalization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published