1.0.0 • Published 8 years ago

grunt-djangularjs-translate v1.0.0

Weekly downloads
40
License
-
Repository
github
Last release
8 years ago

Grunt tasks to automatically extract translations from your djangularjs project

##Status

Stable

Build Status

Getting Started

npm install grunt-djangularjs-translate

NOTE: This extraction tool is made to work with the djangularjs framework.

Example

The configuration below generates 2 translation files:

  • public/i18n/en.js
  • public/i18n/fr.js file
// gruntfile.js 
module.exports = function(grunt) {
    require('load-grunt-tasks')(grunt);
    grunt.initConfig({
        // ...
        translate: {
            all: {
                src: [
                    "public/*[!_]*/*.js",
                    "public/*[!_]*/*[!tests]*/*.js",
                    "public/*[!_]*/*[!tests]*/*.html"
                ],
                lang: ['en', 'fr'],
                dest: 'i18n',
                moduleName: 'core'
            }
        },
        // ...
    });
}
// public/i18n/en.js
angular
    .module('core')
    .config(['$translateProvider', function($translateProvider) {
        $translateProvider.translations('en', {
            key1: 'trans1-en',
            // ...
        });
    }]);
// public/i18n/fr.js
angular
    .module('core')
    .config(['$translateProvider', function($translateProvider) {
        $translateProvider.translations('fr', {
            key1: 'trans1-fr',
            // ...
        });
    }]);

Options

src

List files containing the translations.

Type: Array

Default:

[
  "public/*[!_]*/*.js",
  "public/*[!_]*/*[!tests]*/*.js",
  "public/*[!_]*/*[!tests]*/*.html
]

lang

Define used languages.

Type: Array

Default: ['en']

dest

Name of the translations folder.

Type: String

Default: 'i18n'

moduleName

Name of the angular module mainModule.

Type: String

Default: 'core'

Test

You will find the tests files into test directory.

To run test use grunt test

Credits

Inspired from grunt-angular-translate.

License

The MIT License (MIT)

Copyright (c) 2015-2016 Nicolas Panel

1.0.0

8 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago