Skip to content

Commit

Permalink
Stop using Grunt WP i18n in favor of WP CLI
Browse files Browse the repository at this point in the history
- Improve `/* transalors: */ comments.
- Regenerate french translation.
  • Loading branch information
imath committed Mar 19, 2022
1 parent 7c507ed commit 0058af1
Show file tree
Hide file tree
Showing 24 changed files with 497 additions and 3,609 deletions.
10 changes: 1 addition & 9 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
{
"presets": ["@wordpress/default"],
"plugins": [
[
"@wordpress/babel-plugin-makepot",
{
"output": "languages/js/wp-statuses-sidebar.pot"
}
]
]
"presets": ["@wordpress/default"]
}
27 changes: 5 additions & 22 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ module.exports = function( grunt ) {
clean: {
all: [ 'js/*.min.js', '<%= pkg.name %>.zip', '!js/sidebar*' ]
},
makepot: {
target: {
options: {
domainPath: 'languages',
exclude: ['/node_modules'],
mainFile: 'wp-statuses.php',
potFilename: 'wp-statuses.pot',
processPot: function( pot ) {
pot.headers['last-translator'] = 'imath <contact@imathi.eu>';
pot.headers['language-team'] = 'FRENCH <contact@imathi.eu>';
pot.headers['report-msgid-bugs-to'] = 'https://github.com/imath/wp-statuses/issues';
return pot;
},
type: 'wp-plugin'
}
}
},
uglify: {
minify: {
extDot: 'last',
Expand All @@ -85,13 +68,13 @@ module.exports = function( grunt ) {
}
},
exec: {
js_makepot: {
command: 'npm run pot',
build_parcel: {
command: 'npm run build',
stdout: true,
stderr: true
},
build_parcel: {
command: 'npm run build',
makepot: {
command: 'npm run pot',
stdout: true,
stderr: true
}
Expand All @@ -106,7 +89,7 @@ module.exports = function( grunt ) {

grunt.registerTask( 'compress', ['git-archive'] );

grunt.registerTask( 'release', ['checktextdomain', 'makepot', 'jstest', 'clean', 'uglify', 'exec'] );
grunt.registerTask( 'release', ['checktextdomain', 'jstest', 'clean', 'uglify', 'exec'] );

// Default task.
grunt.registerTask( 'default', ['commit'] );
Expand Down
5 changes: 4 additions & 1 deletion inc/admin/classes/class-wp-statuses-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,12 @@ public function get_time_publishing_div( $post = null, $status = '', $args = arr

// Default stamps.
$stamps = array(
/* translators: 1: the scheduled date for the post. */
'metabox_save_later' => __( 'Schedule for: <b>%1$s</b>', 'wp-statuses' ),
/* translators: 1: the post’s saved date. */
'metabox_saved_date' => __( 'Saved on: <b>%1$s</b>', 'wp-statuses' ),
'metabox_save_now' => __( 'Save <b>now</b>', 'wp-statuses' ),
/* translators: 1: the date to save the post on. */
'metabox_save_date' => __( 'Save on: <b>%1$s</b>', 'wp-statuses' ),
);

Expand Down Expand Up @@ -753,7 +756,7 @@ public function register_block_editor_script() {
wp_statuses_version()
);

$test = wp_set_script_translations( 'wp-statuses-sidebar', 'wp-statuses', trailingslashit( wp_statuses()->dir ) . 'languages/js' );
$test = wp_set_script_translations( 'wp-statuses-sidebar', 'wp-statuses', trailingslashit( wp_statuses()->dir ) . 'languages' );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions inc/core/classes/class-wp-statuses-core-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ public function __construct( $status ) {
'metabox_publish' => __( 'Publish', 'wp-statuses' ),
'metabox_submit' => __( 'Update', 'wp-statuses' ),
'metabox_save_on' => __( 'Publish on:', 'wp-statuses' ),
/* translators: Post date information. 1: Date on which the post is to be published */
/* translators: 1: the date on which the post is to be published */
'metabox_save_date' => __( 'Publish on: <b>%1$s</b>', 'wp-statuses' ),
'metabox_saved_on' => __( 'Published on:', 'wp-statuses' ),
/* translators: Post date information. 1: Date on which the post was published */
/* translators: 1: the date on which the post was published */
'metabox_saved_date' => __( 'Published on: <b>%1$s</b>', 'wp-statuses' ),
'metabox_save_now' => __( 'Publish <b>immediately</b>', 'wp-statuses' ),
/* translators: Post date information. 1: Date on which the post is to be published */
/* translators: 1: the scheduled date for the post. */
'metabox_save_later' => __( 'Schedule for: <b>%1$s</b>', 'wp-statuses' ),
'inline_dropdown' => $this->label,
) );
Expand Down
3 changes: 3 additions & 0 deletions inc/core/custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function wp_statuses_register_members_restricted() {
register_post_status( 'restricted', array(
'label' => _x( 'Restricted to members', 'post status', 'wp-statuses' ),
'public' => true,
/* translators: %s is the number of restricted to members pages. */
'label_count' => _n_noop( 'Restricted to members <span class="count">(%s)</span>', 'Restricted to members <span class="count">(%s)</span>', 'wp-statuses' ),
'post_type' => array( 'page' ), // Just pages for this example :)
'show_in_admin_all_list' => true,
Expand Down Expand Up @@ -54,6 +55,7 @@ function wp_statuses_restrict_content( $content = '' ) {
return $content;
}

/* translators: %s is the login link. */
return sprintf( __( 'Please %s to view this content.', 'wp-statuses' ), sprintf(
'<a href="%1$s">%2$s</a>',
esc_url( wp_login_url( get_permalink( $post->ID ) ) ),
Expand All @@ -70,6 +72,7 @@ function wp_statuses_restrict_content( $content = '' ) {
function wp_statuses_register_archived_post_status() {
register_post_status( 'archive', array(
'label' => __( 'Archive', 'wp-statuses' ),
/* translators: %s is the number of archived posts. */
'label_count' => _n_noop( 'Archived <span class="count">(%s)</span>', 'Archived <span class="count">(%s)</span>', 'wp-statuses' ),
'public' => false,
'show_in_admin_all_list' => false,
Expand Down
1 change: 1 addition & 0 deletions inc/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function wp_statuses_register_password_protected() {
register_post_status( 'password', array(
'label' => _x( 'Password Protected', 'post status', 'wp-statuses' ),
'public' => true,
/* translators: %s is the number of password protected posts. */
'label_count' => _n_noop( 'Password Protected <span class="count">(%s)</span>', 'Password Protected <span class="count">(%s)</span>', 'wp-statuses' ),
'post_type' => wp_statuses_get_registered_post_types( 'password' ),
'show_in_admin_all_list' => false,
Expand Down
2 changes: 1 addition & 1 deletion js/script.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0058af1

Please sign in to comment.