Skip to content

Commit

Permalink
No need to translate
Browse files Browse the repository at this point in the history
  • Loading branch information
seb86 committed Jul 19, 2022
1 parent f2f74ec commit 01fb73b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 112 deletions.
111 changes: 2 additions & 109 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,102 +25,6 @@ module.exports = function(grunt) {
}
},

// Generate .pot file
makepot: {
target: {
options: {
cwd: '',
domainPath: 'languages', // Where to save the POT file.
exclude: [
'releases',
'node_modules',
'vendor'
],
mainFile: '<%= pkg.name %>.php', // Main project file.
potComments: 'Copyright (c) {year} Sébastien Dumont\nThis file is distributed under the same license as the CoCart package.', // The copyright at the beginning of the POT file.
potFilename: '<%= pkg.name %>.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.
'Report-Msgid-Bugs-To': 'https://github.com/co-cart/cocart-cors/issues',
'language-team': 'Sébastien Dumont <mailme@sebastiendumont.com>',
'language': 'en_US'
},
processPot: function( pot ) {
var translation,
excluded_meta = [
'Plugin Name of the plugin/theme',
'Plugin URI of the plugin/theme',
'Description 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;
},
type: 'wp-plugin', // Type of project.
updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
}
}
},

// Check strings for localization issues
checktextdomain: {
options:{
text_domain: '<%= pkg.name %>', // Project text domain.
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,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d'
]
},
files: {
src: [
'*.php',
'**/*.php', // Include all files
'!node_modules/**', // Exclude node_modules/
'!vendor/**' // Exclude vendor/
],
expand: true
},
},

potomo: {
dist: {
options: {
poDel: false
},
files: [{
expand: true,
cwd: 'languages',
src: ['*.po'],
dest: 'languages',
ext: '.mo',
nonull: false
}]
}
},

// Bump version numbers (replace with version in package.json)
replace: {
php: {
Expand Down Expand Up @@ -265,29 +169,18 @@ module.exports = function(grunt) {
}
);

// Set the default grunt command to run test cases.
grunt.registerTask( 'default', [ 'test' ] );
// Set the default grunt command.
grunt.registerTask( 'default', [ 'check' ] );

// Checks for developer dependencies updates.
grunt.registerTask( 'check', [ 'devUpdate' ] );

// Checks for errors.
grunt.registerTask( 'test', [ 'checktextdomain' ] );

// Update version of plugin.
grunt.registerTask( 'version', [ 'replace:php', 'replace:readme' ] );

// Update stable version of plugin.
grunt.registerTask( 'stable', [ 'replace:stable' ] );

/**
* Run i18n related tasks.
*
* This includes extracting translatable strings, updating the master pot file.
* If this is part of a deploy process, it should come before zipping everything up.
*/
grunt.registerTask( 'update-pot', [ 'checktextdomain', 'makepot' ] );

/**
* Creates a deployable plugin zipped up ready to upload
* and install on a WordPress installation.
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@
},
"devDependencies": {
"grunt": "1.5.3",
"grunt-checktextdomain": "1.0.1",
"grunt-contrib-clean": "2.0.1",
"grunt-contrib-compress": "2.0.0",
"grunt-contrib-copy": "1.0.0",
"grunt-dev-update": "2.3.0",
"grunt-newer": "1.3.0",
"grunt-potomo": "3.5.0",
"grunt-text-replace": "0.4.0",
"grunt-wp-i18n": "1.0.3",
"load-grunt-tasks": "5.1.0"
},
"dependencies": {},
Expand Down

0 comments on commit 01fb73b

Please sign in to comment.