Skip to content

Commit

Permalink
Init Grunt tasks with a custom makepot task
Browse files Browse the repository at this point in the history
It is used to generate the pot file of the Next Templats Packs plugin using "grunt makepot".
It can be used by any template pack. For BP Nouveau for instance we can run "grunt makepot --template_pack bp-nouveau".
Running the task allowed me to correct wrong domain in some files.

See #45
  • Loading branch information
imath committed Jul 2, 2016
1 parent cbf1fda commit d7cd0c1
Show file tree
Hide file tree
Showing 18 changed files with 2,115 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .jshintignore
@@ -0,0 +1,2 @@
// Already minified
**/*.min.js
23 changes: 23 additions & 0 deletions .jshintrc
@@ -0,0 +1,23 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"es3": true,
"expr": true,
"immed": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"unused": true,

"browser": true,

"globals": {
"_": false,
"ajaxurl": false,
"Backbone": false,
"jQuery": false,
"wp": false
}
}
59 changes: 59 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,59 @@
/* jshint node:true */
/* global module */
module.exports = function( grunt ) {
require( 'matchdep' ).filterDev( ['grunt-*', '!grunt-legacy-util'] ).forEach( grunt.loadNpmTasks );
grunt.util = require( 'grunt-legacy-util' );

grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
checktextdomain: {
options: {
correct_domain: false,
text_domain: grunt.option( 'template_pack' ) ? grunt.option( 'template_pack' ) : 'next-template-packs',
keywords: [
'__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'_n:1,2,4d',
'_ex:1,2c,3d',
'_nx:1,2,4c,5d',
'esc_attr__:1,2d',
'esc_attr_e:1,2d',
'esc_attr_x:1,2c,3d',
'esc_html__:1,2d',
'esc_html_e:1,2d',
'esc_html_x:1,2c,3d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d'
]
},
files: {
src: grunt.option( 'template_pack' ) ? [ '**/' + grunt.option( 'template_pack' ) + '/**/*.php', '!**/testcases/*'] : ['**/*.php', '!**/node_modules/**', '!**/tests/**', '!**/tools/**', '!**/bp-templates/**'],
expand: true
}
},
exec: {
generate_template_pack_pot: {
command: 'php tools/i18n/bp-makepot.php bp-templatepack bp-templates/' + grunt.option( 'template_pack' ) + ' bp-templates/' + grunt.option( 'template_pack' ) + '/languages/' + grunt.option( 'template_pack' ) + '.pot',
stdout: false
},
generate_manager_pot: {
command: 'php tools/i18n/bp-makepot.php bp-templatepack-manager ../next-template-packs languages/next-template-packs.pot',
stdout: false
},
},
} );

/**
* Register tasks.
*/
grunt.registerTask( 'makepot', 'Generating the pot file...', function( n ) {
grunt.task.run( 'checktextdomain' );

if ( grunt.option( 'template_pack' ) ) {
grunt.task.run( 'exec:generate_template_pack_pot' );
} else {
grunt.task.run( 'exec:generate_manager_pot' );
}
} );
};
Expand Up @@ -199,7 +199,7 @@

<span class="footer_text"><?php echo nl2br( stripslashes( $settings['footer_text'] ) ); ?></span>
<br><br>
<a href="{{{unsubscribe}}}" style="text-decoration: underline;"><?php _ex( 'unsubscribe', 'email', 'buddypress' ); ?></a>
<a href="{{{unsubscribe}}}" style="text-decoration: underline;"><?php _ex( 'unsubscribe', 'email', 'bp-nouveau' ); ?></a>

<?php
/**
Expand Down
Expand Up @@ -63,7 +63,7 @@


<div class="bp-widget">
<h4><?php _e("Members", "buddypress"); ?></h4>
<h4><?php esc_html_e( 'Members', 'bp-nouveau' ); ?></h4>

<?php if ( bp_group_has_members( 'per_page=15&exclude_banned=0' ) ) : ?>

Expand Down
Expand Up @@ -10,7 +10,7 @@
bp_nouveau_group_hook( 'before', 'request_membership_content' ); ?>

<?php if ( ! bp_group_has_requested_membership() ) : ?>
<p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_get_group_name( false ) ); ?></p>
<p><?php printf( __( 'You are requesting to become a member of the group \'%s\'.', 'bp-nouveau' ), bp_get_group_name( false ) ); ?></p>

<form action="<?php bp_group_form_action('request-membership' ); ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form">
<label for="group-request-membership-comments"><?php _e( 'Comments (optional)', 'bp-nouveau' ); ?></label>
Expand Down
Expand Up @@ -22,7 +22,7 @@
<input type="text" name="send-to-input" class="bp-suggestions send-to-input" id="send-to-input" />

<?php if ( bp_current_user_can( 'bp_moderate' ) ) : ?>
<p><label for="send-notice"><input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", "buddypress" ); ?></label></p>
<p><label for="send-notice"><input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php esc_html_e( 'This is a notice to all users.', 'bp-nouveau' ); ?></label></p>
<?php endif; ?>

<label for="subject"><?php _e( 'Subject', 'bp-nouveau' ); ?></label>
Expand Down
Expand Up @@ -101,7 +101,7 @@
<?php endif; ?>

<td class="thread-info">
<p><a href="<?php bp_message_thread_view_link(); ?>" title="<?php esc_attr_e( "View Message", "buddypress" ); ?>"><?php bp_message_thread_subject(); ?></a></p>
<p><a href="<?php bp_message_thread_view_link(); ?>" title="<?php esc_attr_e( 'View Message', 'bp-nouveau' ); ?>"><?php bp_message_thread_subject(); ?></a></p>
<p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p>
</td>

Expand Down
Expand Up @@ -74,7 +74,7 @@

<td width="10%">
<a class="button" href="<?php bp_message_activate_deactivate_link(); ?>" class="confirm"><?php bp_message_activate_deactivate_text(); ?></a>
<a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>">x</a>
<a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php esc_attr_e( 'Delete Message', 'bp-nouveau' ); ?>">x</a>
</td>
</tr>
<?php endwhile; ?>
Expand Down
Expand Up @@ -41,7 +41,7 @@

</span>

<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Conversation", "buddypress" ); ?>"><?php _e( 'Delete', 'bp-nouveau' ); ?></a>
<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( 'Delete Conversation', 'bp-nouveau' ); ?>"><?php _e( 'Delete', 'bp-nouveau' ); ?></a>
</p>

<?php
Expand Down
Expand Up @@ -23,7 +23,7 @@
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_before_profile_field_content' ); ?>

<h4><?php printf( __( "Editing '%s' Profile Group", "buddypress" ), bp_get_the_profile_group_name() ); ?></h4>
<h4><?php printf( __( 'Editing \'%s\' Profile Group', 'bp-nouveau' ), bp_get_the_profile_group_name() ); ?></h4>

<?php if ( bp_profile_has_multiple_groups() ) : ?>
<ul class="button-nav">
Expand Down
4 changes: 2 additions & 2 deletions bp-templates/bp-nouveau/includes/activity/template-tags.php
Expand Up @@ -321,8 +321,8 @@ function bp_nouveau_get_activity_entry_buttons() {
'link_href' => bp_get_activity_delete_url(),
'link_class' => 'button item-button bp-secondary-action ' . $class . ' confirm',
'link_rel' => 'nofollow',
'link_text' => __( 'Delete', 'bp_nouveau' ),
'link_title' => __( 'Delete', 'bp_nouveau' ),
'link_text' => __( 'Delete', 'bp-nouveau' ),
'link_title' => __( 'Delete', 'bp-nouveau' ),
'link_id' => '',
);
}
Expand Down
2 changes: 1 addition & 1 deletion bp-templates/bp-nouveau/includes/classes.php
Expand Up @@ -47,7 +47,7 @@ class BP_Buttons_Group {
*/
public function __construct( $args = array() ) {
if ( empty( $args ) || ! is_array( $args ) ) {
_doing_it_wrong( __( 'You need to use an array containing arrays of parameters.', 'bp_nouveau' ) );
_doing_it_wrong( __( 'You need to use an array containing arrays of parameters.', 'bp-nouveau' ) );
return false;
}

Expand Down

0 comments on commit d7cd0c1

Please sign in to comment.