Bugzilla – Attachment 33217 Details for
Bug 13199
Incoherence between 'en' sample notices and translated notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13199 Test incoherence between 'en' sample notices and translated notices
Bug-13199-Test-incoherence-between-en-sample-notic.patch (text/plain), 5.14 KB, created by
Frédéric Demians
on 2014-11-04 20:22:12 UTC
(
hide
)
Description:
Bug 13199 Test incoherence between 'en' sample notices and translated notices
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2014-11-04 20:22:12 UTC
Size:
5.14 KB
patch
obsolete
>From dcd7cf683dd297e2496a8f40f5c046181470a699 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Tue, 4 Nov 2014 21:04:24 +0100 >Subject: [PATCH] Bug 13199 Test incoherence between 'en' sample notices and > translated notices > >This test identifies incoherences between translated sample notices and the >'en' reference file. > >Koha sample notices are loaded to 'letter' table from a text SQL file >during Koha installation by web installer. The reference file is the one >provided for English (en) installation : > > <koha_root>/installer/data/mysql/en/mandatory/sample_notices.sql > >Alternatives files are provided for other languages. Those files are difficult >to keep synchronized with reference file. This could be an functional issue >since some Koha operation depend on notice existence, for example Print Slip in >Circulation. >--- > xt/sample_notices.t | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 129 insertions(+) > create mode 100755 xt/sample_notices.t > >diff --git a/xt/sample_notices.t b/xt/sample_notices.t >new file mode 100755 >index 0000000..05bd885 >--- /dev/null >+++ b/xt/sample_notices.t >@@ -0,0 +1,129 @@ >+#!/usr/bin/perl >+ >+# Copyright (C) 2014 Tamil s.a.r.l. >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+use Test::More qw(no_plan); >+ >+ >+my $root_dir = 'installer/data/mysql'; >+my $base_notices_file = "en/mandatory/sample_notices.sql"; >+my @trans_notices_files = qw( >+ fr-FR/1-Obligatoire/sample_notices.sql >+ de-DE/mandatory/sample_notices.sql >+ es-ES/mandatory/sample_notices.sql >+ it-IT/necessari/notices.sql >+ nb-NO/1-Obligatorisk/sample_notices.sql >+ pl-PL/mandatory/sample_notices.sql >+ ru-RU/mandatory/sample_notices.sql >+ uk-UA/mandatory/sample_notices.sql >+); >+ >+ok( >+ open( my $ref_fh, "<$root_dir/$base_notices_file" ), >+ "Open reference sample notices file $root_dir/$base_notices_file" ); >+my $ref_notice = get_notices_from_file( $ref_fh ); >+my @ref_notices = sort { lc $a cmp lc $b } keys %$ref_notice; >+cmp_ok( >+ $#ref_notices, '>=', 0, >+ "Found " . ($#ref_notices + 1) . " sample notices" ); >+ >+foreach my $file_name ( @trans_notices_files ) { >+ compare_notices( $file_name ); >+} >+ >+ >+# >+# Get sample notices from SQL file populating letters table with INSERT >+# statement. >+# >+sub get_notices_from_file { >+ my $fh = shift; >+ my %notice; >+ while ( <$fh> ) { >+ next unless /, *'([\_A-Z_]*)'/; >+ $notice{$1} = 1; >+ } >+ return \%notice; >+} >+ >+ >+sub compare_notices { >+ my $trans_file = shift; >+ ok( >+ open( my $trans_fh, "<$root_dir/$trans_file" ), >+ "Open translated sample notices file $root_dir/$trans_file" ); >+ my $trans_notice = get_notices_from_file( $trans_fh ); >+ use YAML; >+ my @trans_notices = sort { lc $a cmp lc $b } keys %$trans_notice; >+ cmp_ok( >+ $#trans_notices, '>=', 0, >+ "Found " . ($#trans_notices + 1) . " notices" ); >+ my @to_add_notices; >+ foreach ( @ref_notices ) { >+ push @to_add_notices, $_ if ! $trans_notice->{$_}; >+ } >+ if ( $#to_add_notices >= 0 ) { >+ fail( 'No sample notice to add') or diag( "Sample notices to add in $trans_file: " . join(', ', @to_add_notices ) ); >+ } >+ else { >+ pass( 'No sample notice to add' ); >+ } >+ >+ my @to_delete_notices; >+ foreach ( @trans_notices ) { >+ push @to_delete_notices, $_ if ! $ref_notice->{$_}; >+ } >+ if ( $#to_delete_notices >= 0 ) { >+ fail( 'No sample notice to delete' ); >+ diag( "Sample notices to delete in $trans_file: " . join(', ', @to_delete_notices ) ); >+ diag( 'Warning: Some of those sample notices may rather have to be added to English notice' ); >+ } >+ else { >+ pass( 'No sample notices to delete' ); >+ } >+} >+ >+ >+=head1 NAME >+ >+sample_notices.t >+ >+=head1 DESCRIPTION >+ >+This test identifies incoherences between translated sample notices and the >+'en' reference file. >+ >+Koha sample notices are loaded to 'letter' table from a text SQL file >+during Koha installation by web installer. The reference file is the one >+provided for English (en) installation : >+ >+ <koha_root>/installer/data/mysql/en/mandatory/sample_notices.sql >+ >+Alternatives files are provided for other languages. Those files are difficult >+to keep synchronized with reference file. This could be an functional issue >+since some Koha operation depend on notice existence, for example Print Slip in >+Circulation. >+ >+=head1 USAGE >+ >+ prove -v sample_notices.t >+ prove sample_notices.t >+ >+=cut >+ >-- >2.1.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 13199
:
33216
|
33217
|
33336
|
33352
|
33353
|
33354
|
33359
|
33360
|
33361