Bugzilla – Attachment 157400 Details for
Bug 35103
Add option to gulp tasks to pass a list of tasks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35103: Add option to gulp tasks to pass a list of tasks
Bug-35103-Add-option-to-gulp-tasks-to-pass-a-list-.patch (text/plain), 1.97 KB, created by
Jonathan Druart
on 2023-10-19 08:58:44 UTC
(
hide
)
Description:
Bug 35103: Add option to gulp tasks to pass a list of tasks
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-19 08:58:44 UTC
Size:
1.97 KB
patch
obsolete
>From f0b78a77def009016b7650cd1b488fa4dd3abb28 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 19 Oct 2023 09:41:03 +0200 >Subject: [PATCH] Bug 35103: Add option to gulp tasks to pass a list of tasks > >You can now generate the messages.po for all languages with: > gulp po:update --task messages > >or for only es-ES > gulp po:update --task messages --lang es-ES > >It may be helpful for the "update po" script that will be used on >weblate. >--- > gulpfile.js | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > >diff --git a/gulpfile.js b/gulpfile.js >index 1c119663ce1..3e471a6f5e7 100644 >--- a/gulpfile.js >+++ b/gulpfile.js >@@ -141,7 +141,29 @@ const poTasks = { > }, > }; > >-const poTypes = Object.keys(poTasks); >+function getPoTasks () { >+ let tasks = []; >+ >+ let all_tasks = Object.keys(poTasks); >+ >+ if (args.task) { >+ tasks = [args.task].flat(Infinity); >+ } else { >+ return all_tasks; >+ } >+ >+ let invalid_tasks = tasks.filter( function( el ) { >+ return all_tasks.indexOf( el ) < 0; >+ }); >+ >+ if ( invalid_tasks.length ) { >+ console.error("Invalid task"); >+ return []; >+ } >+ >+ return tasks; >+} >+const poTypes = getPoTasks(); > > function po_extract_marc (type) { > return src(`koha-tmpl/*-tmpl/*/en/**/*${type}*`, { read: false, nocase: true }) >@@ -387,11 +409,11 @@ function getLanguages () { > return [args.lang]; > } > >- const filenames = fs.readdirSync('misc/translator/po') >- .filter(filename => filename.endsWith('.po')) >+ const filenames = fs.readdirSync('misc/translator/po/') >+ .filter(filename => filename.endsWith('-installer.po')) > .filter(filename => !filename.startsWith('.')) > >- const re = new RegExp('-(' + poTypes.join('|') + ')\.po$'); >+ const re = new RegExp('-installer.po'); > languages = filenames.map(filename => filename.replace(re, '')) > > return Array.from(new Set(languages)); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35103
: 157400