From 63493777a8529748c8b5d1db51d4fd084df0defb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 29 Oct 2013 15:03:41 +0100 Subject: [PATCH] Bug 9216: make columns.def file translatable The SQL column headers is stored into the columns.def file. This file is not managed by the translation script. This patch makes possible the headers translation. Note: The translation xml tags were added to avoid all lines being put on a single line. Test plan: 1/ update your po file cd misc/translate; perl translate -f columns update LANG # Replace by another language here 2/ translate header columns (search "columns.def" in your po file). 3/ install the translated columns.def perl translate -f columns install LANG # Replace by another language here 4/ go on the report module > create a new report > next > next 5/ change the language on the 3rd step, you should see the column header translated. Signed-off-by: Bernardo Gonzalez Kriegel Work as described, no koha-qa errors [on es-ES about a third of the strings translated!! :-) ] Signed-off-by: Katrin Fischer Works as described and fixes a long standing translation problem. Passes all tests and QA script. Signed-off-by: Galen Charlton (cherry picked from commit bece83f8ed59208e058dc87830cbab2aa19bb2f7) Signed-off-by: Fridolin Somers --- C4/Reports/Guided.pm | 38 +-- koha-tmpl/intranet-tmpl/prog/en/columns.def | 282 ++++++++++---------- misc/translator/tmpl_process3.pl | 2 +- 3 files changed, 163 insertions(+), 159 deletions(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index f8270900fe..0a4294a488 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -834,23 +834,27 @@ sub get_sql { } sub _get_column_defs { - my ($cgi) = @_; - my %columns; - my $columns_def_file = "columns.def"; - my $htdocs = C4::Context->config('intrahtdocs'); - my $section='intranet'; - my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, $columns_def_file, $section,$cgi); - - my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file"; - open (COLUMNS,$full_path_to_columns_def_file); - while (my $input = ){ - chomp $input; - my @row =split(/\t/,$input); - $columns{$row[0]}= $row[1]; - } - - close COLUMNS; - return \%columns; + my ($cgi) = @_; + my %columns; + my $columns_def_file = "columns.def"; + my $htdocs = C4::Context->config('intrahtdocs'); + my $section = 'intranet'; + + # We need the theme and the lang + # Since columns.def is not in the modules directory, we cannot sent it for the $tmpl var + my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, 'about.tt', $section, $cgi); + + my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file"; + open (my $fh, $full_path_to_columns_def_file); + while ( my $input = <$fh> ){ + chomp $input; + if ( $input =~ m|(.*)| ) { + my ( $field, $translation ) = ( $1, $2 ); + $columns{$field} = $translation; + } + } + close $fh; + return \%columns; } =head2 build_authorised_value_list($authorised_value) diff --git a/koha-tmpl/intranet-tmpl/prog/en/columns.def b/koha-tmpl/intranet-tmpl/prog/en/columns.def index dc863e4c88..b9ac8f68a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/columns.def +++ b/koha-tmpl/intranet-tmpl/prog/en/columns.def @@ -1,141 +1,141 @@ -borrowers.borrowernumber Borrower number -borrowers.title Salutation -borrowers.surname Surname -borrowers.firstname First name -borrowers.dateofbirth Date of birth -borrowers.initials Initials -borrowers.othernames Other name -borrowers.sex Gender -borrowers.relationship Relationship -borrowers.guarantorid Guarantor borrower number -borrowers.streetnumber Street number -borrowers.streettype Street type -borrowers.address Address -borrowers.address2 Address 2 -borrowers.city City -borrowers.state State -borrowers.zipcode Zip/postal code -borrowers.country Country -borrowers.phone Primary phone -borrowers.phonepro Secondary phone -borrowers.mobile Other phone -borrowers.email Primary email -borrowers.emailpro Secondary email -borrowers.fax Fax -borrowers.B_streetnumber Alternate address: Street number -borrowers.B_streettype Alternate address: Street type -borrowers.B_address Alternate address: Address -borrowers.B_address2 Alternate address: Address 2 -borrowers.B_city Alternate address: City -borrowers.B_state Alternate address: State -borrowers.B_zipcode Alternate address: Zip/postal code -borrowers.B_country Alternate address: Country -borrowers.B_phone Alternate address: Phone -borrowers.B_email Alternate address: Email -borrowers.contactnote Alternate contact: Note -borrowers.altcontactfirstname Alternate contact: Last name -borrowers.altcontactsurname Alternate contact: First name -borrowers.altcontactaddress1 Alternate contact: Address -borrowers.altcontactaddress2 Alternate contact: Address 2 -borrowers.altcontactaddress3 Alternate contact: City -borrowers.contactname Alternate contact: Surname -borrowers.contactfirstname Alternate contact: First name -borrowers.contacttitle Alternate contact: Title -borrowers.altcontactstate Alternate contact: State -borrowers.altcontactzipcode Alternate contact: Zip/postal code -borrowers.altcontactcountry Alternate contact: Country -borrowers.altcontactphone Alternate contact: Phone -borrowers.cardnumber Card number -borrowers.branchcode Home library -borrowers.categorycode Category -borrowers.sort1 Sort 1 -borrowers.sort2 Sort 2 -borrowers.dateenrolled Registration date -borrowers.dateexpiry Expiry date -borrowers.opacnote OPAC note -borrowers.borrowernotes Circulation note -borrowers.userid Username -borrowers.password Password -borrowers.flags System permissions -borrowers.gonenoaddress Gone no address flag -borrowers.lost Lost card flag -borrowers.debarred Restricted [until] flag -borrowers.debarredcomment Comment -borrowers.smsalertnumber Mobile phone number -borrowers.privacy Privacy settings -items.itemnumber Item number (internal) -items.biblionumber Biblio number (internal) -items.biblioitemnumber Biblioitem number (internal) -items.barcode Barcode -items.dateaccessioned Date acquired -items.booksellerid Source of acquisition -items.homebranch Permanent library -items.price Price -items.replacementprice Replacement price -items.replacementpricedate Price effective from -items.datelastborrowed Date last checked out -items.datelastseen Date last seen -items.stack Shelving control number -items.onloan Due date -items.cn_source Source of classification / shelving scheme -items.cn_sort Koha normalized classification for sorting -items.notforloan Not for loan -items.itemlost Lost status -items.withdrawn Withdrawn status -items.itemcallnumber Call number -items.issues Total checkouts -items.renewals Total renewals -items.reserves Total holds -items.restricted Use restrictions -items.itemnotes Public note -items.holdingbranch Current library -items.paidfor -items.timestamp Timestamp -items.location Shelving location -items.ccode Collection code -items.itype Koha itemtype -items.stocknumber Inventory number -items.damaged Damaged status -items.materials Materials specified -items.uri Uniform Resource Identifier -items.more_subfields_xml Additional subfields (XML) -items.enumchron Serial enumeraton/chronology -items.copynumber Copy number -statistics.datetime Statistics date and time -statistics.branch Library -statistics.proccode Type of procedure -statistics.value Value -statistics.type Type -statistics.other -statistics.usercode User code -statistics.itemnumber Item number -statistics.itemtype Itemtype -statistics.borrowernumber Borrower number -biblio.frameworkcode Framework code -biblio.author Author -biblio.datecreated Creation date -biblio.timestamp Modification date -biblioitems.biblioitemnumber Biblioitem number -biblioitems.biblionumber Biblio number -biblioitems.volume Volume number -biblioitems.number Number -biblioitems.classification Classification -biblioitems.itemtype Biblio-level item type -biblioitems.isbn ISBN -biblioitems.issn ISSN -biblioitems.dewey Dewey/classification -biblioitems.subclass Sub classification -biblioitems.publicationyear Publication date -biblioitems.publishercode Publisher -biblioitems.volumedate Volume date -biblioitems.volumedesc Volume information -biblioitems.timestamp Timestamp -biblioitems.illus Illustrator -biblioitems.pages Number of pages -biblioitems.notes Notes -biblioitems.size Size -biblioitems.place Place of publication -biblioitems.lccn LCCN -biblioitems.marcxml MARC blob -biblioitems.url URL -biblioitems.title Title +Borrower number +Salutation +Surname +First name +Date of birth +Initials +Other name +Gender +Relationship +Guarantor borrower number +Street number +Street type +Address +Address 2 +City +State +Zip/postal code +Country +Primary phone +Secondary phone +Other phone +Primary email +Secondary email +Fax +Alternate address: Street number +Alternate address: Street type +Alternate address: Address +Alternate address: Address 2 +Alternate address: City +Alternate address: State +Alternate address: Zip/postal code +Alternate address: Country +Alternate address: Phone +Alternate address: Email +Alternate contact: Note +Alternate contact: Last name +Alternate contact: First name +Alternate contact: Address +Alternate contact: Address 2 +Alternate contact: City +Alternate contact: Surname +Alternate contact: First name +Alternate contact: Title +Alternate contact: State +Alternate contact: Zip/postal code +Alternate contact: Country +Alternate contact: Phone +Card number +Home library +Category +Sort 1 +Sort 2 +Registration date +Expiry date +OPAC note +Circulation note +Username +Password +System permissions +Gone no address flag +Lost card flag +Restricted [until] flag +Comment +Mobile phone number +Privacy settings +Item number (internal) +Biblio number (internal) +Biblioitem number (internal) +Barcode +Date acquired +Source of acquisition +Permanent library +Price +Replacement price +Price effective from +Date last checked out +Date last seen +Shelving control number +Due date +Source of classification / shelving scheme +Koha normalized classification for sorting +Not for loan +Lost status +Withdrawn status +Call number +Total checkouts +Total renewals +Total holds +Use restrictions +Public note +Current library +Timestamp +Shelving location +Collection code +Koha itemtype +Inventory number +Damaged status +Materials specified +Uniform Resource Identifier +Additional subfields (XML) +Serial enumeraton/chronology +Copy number +Statistics date and time +Library +Type of procedure +Value +Type +User code +Item number +Itemtype +Borrower number +Framework code +Author +Creation date +Modification date +Biblioitem number +Biblio number +Volume number +Number +Classification +Biblio-level item type +ISBN +ISSN +Dewey/classification +Sub classification +Publication date +Publisher +Volume date +Volume information +Timestamp +Illustrator +Number of pages +Notes +Size +Place of publication +LCCN +MARC blob +URL +Title diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index 81bd3e10d2..eea5f3e208 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -242,7 +242,7 @@ usage_error('You must at least specify input and string list filenames.') if !$in_dir || !defined $str_file; # Type match defaults to *.tt plus *.inc if not specified -$type = "tt|inc|xsl|xml" if !defined($type); +$type = "tt|inc|xsl|xml|def" if !defined($type); # Check the inputs for being directories usage_error("$in_dir: Input must be a directory.\n" -- 2.39.5