Bugzilla – Attachment 177354 Details for
Bug 38900
Translation script explodes without a meaningful error when an "incorrect" structure is found
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38900: Provide info about the problematic strings
Bug-38900-Provide-info-about-the-problematic-strin.patch (text/plain), 2.46 KB, created by
Julian Maurice
on 2025-01-30 14:27:37 UTC
(
hide
)
Description:
Bug 38900: Provide info about the problematic strings
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2025-01-30 14:27:37 UTC
Size:
2.46 KB
patch
obsolete
>From 5aba5d26cef22d3dc901db37bb51c819b6c3aec4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Jan 2025 14:30:00 +0100 >Subject: [PATCH] Bug 38900: Provide info about the problematic strings > >The translation script explodes without meaningful error when >"incorrect" structure is found (edit) > >Found when working on bug 38714, the translation script can break with >an error that does not directly point to the problematic string > >[13:00:23] Error: Command failed: misc/translator/xgettext.pl --charset=UTF-8 -F -o /tmp/koha-2rwDEm/Koha-opac-bootstrap.pot -f /tmp/koha-2rwDEm/files >Can't use an undefined value as a HASH reference at misc/translator/xgettext.pl line 131. > > at ChildProcess.exithandler (node:child_process:422:12) > at ChildProcess.emit (node:events:517:28) > at ChildProcess.emit (node:domain:552:15) > at maybeClose (node:internal/child_process:1098:16) > at ChildProcess._handle.onexit (node:internal/child_process:303:5) > at Process.callbackTrampoline (node:internal/async_hooks:128:17) >[13:00:23] 'po:update' errored after 992 ms > >Test plan: >0. Use main and confirm that `gulp po:update --lang LANG` returns > successfully >1. Apply the first patch >=> The error is >Can't use an undefined value as a HASH reference at misc/translator/xgettext.pl line 131, <$INPUT> line 80. >2. Apply this patch >=> The error is now: >Incorrect structure found at ./koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt:230: '<option value="*" ' at misc/translator/xgettext.pl line 124, <$INPUT> line 100. > >Which is way more interesting to fix the problem as we know exactly >where the problem comes from > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > misc/translator/xgettext.pl | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl >index bcf6601967..f11b868d8d 100755 >--- a/misc/translator/xgettext.pl >+++ b/misc/translator/xgettext.pl >@@ -120,6 +120,10 @@ sub text_extract { > my $s = TmplTokenizer::next_token($h); > last unless defined $s; > my($kind, $t, $attr) = ($s->type, $s->string, $s->attributes); >+ >+ die sprintf( "Incorrect structure found at %s:%s: '%s'", $s->pathname, $s->line_number, $s->string ) >+ if $kind eq C4::TmplTokenType::TAG && !$attr; >+ > if ($kind eq C4::TmplTokenType::TEXT) { > if ($t =~ /\S/s && $t !~ /<!/){ > remember( $s, $t ); >-- >2.39.2
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 38900
:
176568
|
176569
|
176570
|
176583
|
176584
| 177354