[Koha-bugs] [Bug 25067] Move PO file manipulation code into gulp tasks
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Apr 23 12:41:45 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25067
Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #103403|0 |1
is obsolete| |
--- Comment #20 from Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> ---
Created attachment 103562
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=103562&action=edit
Bug 25067: Move PO file manipulation code into gulp tasks
misc/translator/translate was doing three different things:
- extract translatable strings
- create or update PO files
- install translated templates
This patch separates responsibilities by moving the string extraction
code into several 'xgettext-like' scripts and adds gulp tasks to
automate string extraction and PO files update
This has several benefits:
- gulp runs tasks in parallel, so it's a lot faster (updating all PO
files is at least 10 times faster with my 4-cores CPU)
- there is no need for $KOHA_CONF to be defined
LangInstaller.pm relied on $KOHA_CONF to get the different paths
needed. I'm not sure why, since string extraction and PO update should
work on source files, not installed files
- string extraction code can be more easily tested
This patch also brings a couple of fixes and improvements:
- TT string extraction (strings wrapped in [% t(...) %]) was done with
Template::Parser and PPI, which was extremely slow, and had some
problems (see bug 24797).
This is now done with Locale::XGettext::TT2 (new dependency) which is
a lot faster, and fixes bug 24797
- string extraction for system preferences was putting context inside
msgid. For instance:
# Accounting > Policy
msgid "accounting.pref#FinePaymentAutoPopup# automatically display "
"a print dialog for a payment receipt when making a payment.."
Now context is put into msgctxt, and the reference is set, which is
cleaner
#:
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref
msgctxt "Accounting > Policy > FinePaymentAutoPopup"
msgid "automatically display a print dialog for a payment receipt "
"when making a payment.."
The downside is that some messages will have to be re-translated,
especially short messages like 'Do', for which msgmerge has a hard
time finding the corresponding new msgid.
- Replace deprecated gulp-util by recommended minimist
- Fix header in 3 PO files
Test plan:
1. Run `yarn install` and install Locale::XGettext::TT2
2. Run `gulp po:update`
3. Verify the contents of updated PO files
4. Run `cd misc/translator && ./translate install <lang>`
5. Verify that all (templates, sysprefs, xslt, installer files) is
correctly translated
6. Run `gulp po:create --lang <lang>` and verify that it created all PO
files for that language
7. Run `prove t/misc/translator`
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>
Need to install yarn & gulp, no errors
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list