Skip to content

Commit cbc02fb

Browse files
committed
Centralize i18n settings to match contributor docs
Slightly clean up build and add an extra handlebars helper
1 parent f9d2b32 commit cbc02fb

File tree

10 files changed

+216
-221
lines changed

10 files changed

+216
-221
lines changed

Gruntfile.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -244,22 +244,28 @@ module.exports = function(grunt) {
244244
dest: '<%= config.dist %>/assets/reference'
245245
},
246246
reference_assets: {
247-
expand: true,
248-
cwd: '<%= config.src %>/templates/pages/reference/',
249-
src: ['**/!(*.hbs)'],
250-
dest: '<%= config.dist %>/reference/'
251-
},
252-
reference_es: {
253-
expand: true,
254-
cwd: '<%= config.dist %>/reference',
255-
src: ['**'],
256-
dest: '<%= config.dist %>/es/reference'
257-
},
258-
reference_zh_Hans: {
259-
expand: true,
260-
cwd: '<%= config.dist %>/reference',
261-
src: ['**'],
262-
dest: '<%= config.dist %>/zh-Hans/reference'
247+
files: (function() {
248+
const cp = [];
249+
pkg.languages.forEach(language => {
250+
if (language === 'en') {
251+
cp.push({
252+
expand: true,
253+
cwd: '<%= config.src %>/templates/pages/reference/',
254+
src: ['**/!(*.hbs)'],
255+
dest: '<%= config.dist %>/reference/'
256+
});
257+
} else {
258+
cp.push({
259+
expand: true,
260+
cwd: '<%= config.src %>/templates/pages/reference/',
261+
src: ['**/!(*.hbs)'],
262+
dest: `<%= config.dist %>/${language}/reference/`
263+
});
264+
}
265+
});
266+
267+
return cp;
268+
})()
263269
},
264270
offlineReference: {
265271
files: [
@@ -319,7 +325,7 @@ module.exports = function(grunt) {
319325
compress: {
320326
main: {
321327
options: {
322-
archive: '<%= config.dist %>/offline-reference/p5-reference.zip',
328+
archive: '<%= config.dist %>/offline-reference/p5-reference.zip'
323329
},
324330
expand: true,
325331
cwd: '<%= config.src %>/offline-reference',
@@ -331,14 +337,11 @@ module.exports = function(grunt) {
331337
all: {
332338
src: [
333339
'<%= config.dist %>/**/*.html',
334-
'!<%= config.dist %>/es/**/*.html',
335-
'!<%= config.dist %>/zh-Hans/**/*.html',
336340
'!<%= config.dist %>/**/CHANGES.html',
337341
'!<%= config.dist %>/**/README.html',
338342
'!<%= config.dist %>/**/p5_featured/**/*.html',
339343
'!<%= config.dist %>/**/learn/*.html',
340-
'!<%= config.dist %>/**/examples/*.html',
341-
'!<%= config.dist %>/reference/assets/index.html'
344+
'!<%= config.dist %>/**/examples/*.html'
342345
],
343346
options: {
344347
ignore: [

0 commit comments

Comments
 (0)