From fc0b8f684371bcde8dbfc92f735b9b75ff585c9a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 7 Jun 2023 10:49:05 +0200 Subject: [PATCH] Bug 33856: Make inventory problems translatable We should make the inventory 'problem' column translatable. Test plan: Update po, translate the new strings, install the language, use it for the UI and confirm that the CSV generated has 'problem' column translated gulp po:update --lang LANG vim misc/translator/po/LANG-messages-js.po cd misc/translator; perl translate install LANG --- tools/inventory.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index ace4e7cb7bb..c8be569a985 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -35,6 +35,7 @@ use C4::Circulation qw( barcodedecode AddReturn ); use C4::Reports::Guided qw( ); use C4::Charset qw( NormalizeString ); +use Koha::I18N qw(__); use Koha::Biblios; use Koha::DateUtils qw( dt_from_string ); use Koha::Database::Columns; @@ -405,7 +406,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ my ( $table, $column ) = split '\.', $key; push @translated_keys, NormalizeString($columns->{$table}->{$column} // ''); } - push @translated_keys, 'problem' if $uploadbarcodes; + push @translated_keys, __('problem') if $uploadbarcodes; $csv->combine(@translated_keys); print $csv->string, "\n"; @@ -419,15 +420,15 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ my $errstr = ''; foreach my $key ( keys %{$item->{problems}} ) { if( $key eq 'wrongplace' ) { - $errstr .= "wrong place,"; + $errstr .= __("wrong place") . ','; } elsif( $key eq 'changestatus' ) { - $errstr .= "unknown notforloan status,"; + $errstr .= __("unknown notforloan status") . ','; } elsif( $key eq 'not_scanned' ) { - $errstr .= "missing,"; + $errstr .= __("missing") . ','; } elsif( $key eq 'no_barcode' ) { - $errstr .= "no barcode,"; + $errstr .= __("no barcode") . ','; } elsif( $key eq 'checkedout' ) { - $errstr .= "checked out,"; + $errstr .= __("checked out") . ','; } } $errstr =~ s/,$//; @@ -440,7 +441,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ my @line; if ($error->{'ERR_BARCODE'}) { push @line, map { $_ eq 'barcode' ? $error->{'barcode'} : ''} @keys; - push @line, "barcode not found"; + push @line, __("barcode not found"); $csv->combine(@line); print $csv->string, "\n"; } -- 2.25.1