Skip to content

Commit

Permalink
Merge pull request #80 from skaut/l18n
Browse files Browse the repository at this point in the history
i10n infrastructure
  • Loading branch information
marekdedic authored Mar 11, 2020
2 parents 72d5898 + 5aac530 commit cad91b5
Show file tree
Hide file tree
Showing 9 changed files with 931 additions and 14 deletions.
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ workflows:
- lint:
requires:
- build
- translation-sync
- package:
filters:
branches:
Expand Down Expand Up @@ -59,6 +60,11 @@ jobs:
- run: *install_npm
- save_cache: *save_npm

- run:
name: "Install gettext"
command: |
sudo apt-get update
sudo apt-get install gettext
- run:
name: "Build"
command: npm run build
Expand Down Expand Up @@ -91,6 +97,30 @@ jobs:
- run:
name: "Lint"
command: npm run lint

translation-sync:
docker:
- image: circleci/node:latest
steps:
- checkout

- restore_cache: *restore_npm
- run: *install_npm
- save_cache: *save_npm

- run:
name: "Install gettext"
command: |
sudo apt-get update
sudo apt-get install gettext
- run:
name: "Update translations"
command: npm run update-translations
- run:
name: Check for clean repo
command: |
[ -z "$(git status --porcelain)" ] || (c=$?; git status; (exit $c))
package:
docker:
- image: circleci/golang:latest
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

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

43 changes: 43 additions & 0 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ const composer = require("gulp-uglify/composer");
const concat = require("gulp-concat");
const inject = require("gulp-inject-string");
const merge = require("merge-stream");
const potomo = require("gulp-potomo");
const rename = require("gulp-rename");
const shell = require("gulp-shell");
const ts = require("gulp-typescript");
const uglify = require("uglify-js");
const wpPot = require("gulp-wp-pot");

const minify = composer(uglify, console);

Expand Down Expand Up @@ -88,6 +91,13 @@ gulp.task("build:js", function() {
);
});

gulp.task("build:mo", function() {
return gulp
.src("src/languages/*.po")
.pipe(potomo({ verbose: false }))
.pipe(gulp.dest("dist/languages/"));
});

gulp.task("build:php:root", function() {
return gulp.src("src/php/*.php").pipe(gulp.dest("dist/"));
});
Expand Down Expand Up @@ -139,8 +149,41 @@ gulp.task(
"build:deps",
"build:jpg",
"build:js",
"build:mo",
"build:php",
"build:png",
"build:txt"
)
);

gulp.task(
"update-translations:generate-pot",
gulp.series(function() {
return gulp
.src("src/php/**/*.php")
.pipe(
wpPot({
bugReport: "https://github.com/skaut/crdm-modern/issues",
domain: "crdm-modern",
relativeTo: "src/php"
})
)
.pipe(gulp.dest("src/languages/crdm-modern.pot"));
}, shell.task(
"msgmerge -U src/languages/crdm-modern.pot src/languages/crdm-modern.pot"
))
);

gulp.task("update-translations:update-po", function() {
return gulp
.src("src/languages/*.po", { read: false })
.pipe(shell("msgmerge -U <%= file.path %> src/languages/crdm-modern.pot"));
});

gulp.task(
"update-translations",
gulp.series(
"update-translations:generate-pot",
"update-translations:update-po"
)
);
Loading

0 comments on commit cad91b5

Please sign in to comment.