Skip to content

Commit 458aede

Browse files
committed
Add a translations job to CI pipeline
1 parent 209d112 commit 458aede

10 files changed

Lines changed: 1312 additions & 48 deletions

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ jobs:
9595
- run:
9696
name: Build and package
9797
command: npx @gravitykit/gktools build
98+
- run:
99+
name: Trigger translation pipeline
100+
command: |
101+
if [ "${CIRCLE_BRANCH}" == "develop" ] || [ "${CIRCLE_BRANCH}" == "main" ]; then
102+
npx @gravitykit/gktools translate gk-gravityexport-lite --commit --push
103+
else
104+
echo "Skipping translation pipeline."
105+
fi
98106
- run:
99107
name: Create GitHub release
100108
command: npx @gravitykit/gktools release

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ phpstan-stubs export-ignore
2424
/src export-ignore
2525
/tests export-ignore
2626
.env.sample export-ignore
27+
Gruntfile.js export-ignore
2728
package.json export-ignore
2829
package-lock.json export-ignore
30+
translations.pot export-ignore
2931
.gktools.json export-ignore
3032
.gktools.env export-ignore

.gktools.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"build": [
33
"npm install",
4+
"grunt",
45
"composer build"
56
],
67
"package": {

Gruntfile.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module.exports = function ( grunt ) {
2+
'use strict';
3+
4+
grunt.initConfig( {
5+
addtextdomain: {
6+
options: {
7+
textdomain: 'gk-gravityexport-lite',
8+
updateDomains: []
9+
},
10+
target: {
11+
files: {
12+
src: [
13+
'*.php',
14+
'src/**/*.php',
15+
'!src/Addon/AddonHelperTrait.php',
16+
'!src/Addon/GravityExportAddon.php',
17+
'!src/Field/ProductField.php',
18+
'!src/GravityForms/Field/DownloadFile.php',
19+
'!src/Repository/FieldsRepository.php',
20+
'public/**/*.php'
21+
]
22+
}
23+
}
24+
},
25+
26+
exec: {
27+
makepot: {
28+
cmd: function () {
29+
var fileComments = [
30+
'Copyright (C) ' + new Date().getFullYear() + ' GravityKit',
31+
'This file is distributed under the GPLv2 or later',
32+
];
33+
34+
var headers = {
35+
'Last-Translator': 'GravityKit <support@gravitykit.com>',
36+
'Language-Team': 'GravityKit <support@gravitykit.com>',
37+
'Language': 'en_US',
38+
'Plural-Forms': 'nplurals=2; plural=(n != 1);',
39+
'Report-Msgid-Bugs-To': 'https://www.gravitykit.com/support',
40+
};
41+
42+
var command = 'wp i18n make-pot --exclude=build,tests,vendor,assets . translations.pot';
43+
44+
command += ' --file-comment="' + fileComments.join( '\n' ) + '"';
45+
46+
command += ' --headers=\'' + JSON.stringify( headers ) + '\'';
47+
48+
return command;
49+
}
50+
}
51+
}
52+
} );
53+
54+
grunt.loadNpmTasks( 'grunt-exec' );
55+
grunt.loadNpmTasks( 'grunt-wp-i18n' );
56+
57+
grunt.registerTask( 'default', [ 'addtextdomain', 'exec:makepot' ] );
58+
};

0 commit comments

Comments
 (0)