0.0.19 • Published 8 years ago
grunt-intranslation v0.0.19
grunt-intranslation
Searches PHP and HBS files for phrases in need of translation.
Getting Started
npm install grunt-intranslation --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-intranslation');
In PHP files, translation tags should look like this:
translate('word', 'tag');
In Handlebars files, translation tags should look like this:
{{trans "word" "tag"}}
It also strips file-name tags at the beginning:
translate("word", "/file.php/tag");
The "intranslation" task
Overview
In your project's Gruntfile, add a section named intranslation
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
intranslation: {
options: {
path: 'content/public',
path_translations: 'translation/existing_translations.json',
path_reconcile: '', // default against reconciling
debug: false
}
},
});
Usage Examples
Default Options
The following options are default - used for testing.
grunt.initConfig({
intranslation: {
options: {
path: 'test/fixtures/content/public',
path_write: 'tmp/need_translation.json',
json_pretty: 'pretty',
path_translations: 'test/fixtures/existing_translations.json',
path_reconcile: '', // default against reconciling
debug: false
}
},
});
Release History
0.0.19 - Add sorting of words. 0.0.18 - Add support for file-name tag. 0.0.17 - Clean up some glitches.