-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New: Script Optimization - Give now only loads one minified JS scri…
…pt and one CSS file to keep load times fast and minimize footprint * New: Using Grunt to generate POT file now for much more timely and accurate translations * Fix: Incorrect amount formatting when currency separators set to "," for both thousands and decimals. @see: #150
- Loading branch information
devin
committed
Jun 3, 2015
1 parent
47fd70c
commit b2e7966
Showing
8 changed files
with
1,305 additions
and
1,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
module.exports = function ( grunt ) { | ||
|
||
// Load multiple grunt tasks using globbing patterns | ||
require( 'load-grunt-tasks' )( grunt ); | ||
|
||
// Project configuration. | ||
grunt.initConfig( { | ||
pkg: grunt.file.readJSON( 'package.json' ), | ||
|
||
checktextdomain: { | ||
options: { | ||
text_domain : 'give', | ||
create_report_file: true, | ||
keywords : [ | ||
'__:1,2d', | ||
'_e:1,2d', | ||
'_x:1,2c,3d', | ||
'esc_html__:1,2d', | ||
'esc_html_e:1,2d', | ||
'esc_html_x:1,2c,3d', | ||
'esc_attr__:1,2d', | ||
'esc_attr_e:1,2d', | ||
'esc_attr_x:1,2c,3d', | ||
'_ex:1,2c,3d', | ||
'_n:1,2,3,4d', | ||
'_nx:1,2,4c,5d', | ||
'_n_noop:1,2,3d', | ||
'_nx_noop:1,2,3c,4d', | ||
' __ngettext:1,2,3d', | ||
'__ngettext_noop:1,2,3d', | ||
'_c:1,2d', | ||
'_nc:1,2,4c,5d' | ||
] | ||
}, | ||
files : { | ||
src : [ | ||
'**/*.php', // Include all files | ||
'!node_modules/**', // Exclude node_modules/ | ||
'!build/.*'// Exclude build/ | ||
], | ||
expand: true | ||
} | ||
}, | ||
|
||
makepot: { | ||
target: { | ||
options: { | ||
domainPath : '/languages/', // Where to save the POT file. | ||
exclude : ['includes/libraries/.*', '.js'], | ||
mainFile : 'give.php', // Main project file. | ||
potFilename : 'give.pot', // Name of the POT file. | ||
potHeaders : { | ||
poedit : true, // Includes common Poedit headers. | ||
'x-poedit-keywordslist': true // Include a list of all possible gettext functions. | ||
}, | ||
type : 'wp-plugin', // Type of project (wp-plugin or wp-theme). | ||
updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes. | ||
processPot : function ( pot, options ) { | ||
pot.headers['report-msgid-bugs-to'] = 'https://givewp.com/'; | ||
pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)'; | ||
pot.headers['language-team'] = 'WP-Translations <wpt@wp-translations.org>'; | ||
pot.headers['language'] = 'en_US'; | ||
var translation, // Exclude meta data from pot. | ||
excluded_meta = [ | ||
'Plugin Name of the plugin/theme', | ||
'Plugin URI of the plugin/theme', | ||
'Author of the plugin/theme', | ||
'Author URI of the plugin/theme' | ||
]; | ||
for ( translation in pot.translations[''] ) { | ||
if ( 'undefined' !== typeof pot.translations[''][translation].comments.extracted ) { | ||
if ( excluded_meta.indexOf( pot.translations[''][translation].comments.extracted ) >= 0 ) { | ||
console.log( 'Excluded meta: ' + pot.translations[''][translation].comments.extracted ); | ||
delete pot.translations[''][translation]; | ||
} | ||
} | ||
} | ||
return pot; | ||
} | ||
} | ||
} | ||
}, | ||
|
||
exec: { | ||
txpull : { // Pull Transifex translation - grunt exec:txpull | ||
cmd: 'tx pull -a -f --minimum-perc=1' // Change the percentage with --minimum-perc=yourvalue | ||
}, | ||
txpush_s: { // Push pot to Transifex - grunt exec:txpush_s | ||
cmd: 'tx push -s' | ||
} | ||
}, | ||
|
||
dirs: { | ||
lang: 'languages' | ||
}, | ||
|
||
potomo: { | ||
dist: { | ||
options: { | ||
poDel: true | ||
}, | ||
files : [{ | ||
expand: true, | ||
cwd : '<%= dirs.lang %>', | ||
src : ['*.po'], | ||
dest : '<%= dirs.lang %>', | ||
ext : '.mo', | ||
nonull: true | ||
}] | ||
} | ||
} | ||
|
||
|
||
} ); | ||
|
||
// Default task. - grunt makepot | ||
grunt.registerTask( 'default', 'makepot' ); | ||
|
||
// Makepot and push it on Transifex task(s). | ||
grunt.registerTask( 'tx-push', ['makepot', 'exec:txpush_s'] ); | ||
|
||
// Pull from Transifex and create .mo task(s). | ||
grunt.registerTask( 'tx-pull', ['exec:txpull', 'potomo'] ); | ||
|
||
// Build task(s). | ||
// grunt.registerTask( 'build', ['clean', 'copy', 'compress'] ); | ||
|
||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.