用于构建多语言环境,只需要维护语言包,而不需要维护多个html文件
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tasks
test
.gitignore
.jshintrc
Gruntfile.js
LICENSE-MIT
README.md
package.json

README.md

grunt-multi-language

grunt multi language tool

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-multi-language --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-multi-language');

The "multi_language" task

Overview

In your project's Gruntfile, add a section named multi_language to the data object passed into grunt.initConfig().

grunt.initConfig({
  multi_language: {
    translate: {
      resources: 'test/lang/',
      options: {
        tag: '{{ }}',
        src: 'test/fixtures/test.html',
        dest: 'tmp'
      }
    }
  },
})

Options

options.tag

Type: String Default value: '{{ }} '

语言包中使用的标签 例如 {{lang-to-translate}} ,如果默认的标签和文件中的其他标签的产生冲突,只需要覆盖默认配置即可,例如 "(| |)"

options.src

Type: String Default value: '.'

需要翻译的源文件

Usage Examples

grunt.initConfig({
  multi_language: {
    translate: {
      resources: 'test/lang/',
      options: {
        tag: '{{ }}',
        src: 'test/fixtures/test.html',
        dest: 'tmp'
      }
    }
  },
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2013-11-13 v0.1.1 调整测试用例, 增加文件格式过滤,增加lang语言值
  • 2013-11-12  v0.1.0  完成翻译语言包功能

Task submitted by Andrew zhang

This file was generated on 2013-11-13 11:48:10