Bugzilla – Attachment 108130 Details for
Bug 24973
Allow to localize and translate system preferences with new yaml based installer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24973: Load custom localization file
Bug-24973-Load-custom-localization-file.patch (text/plain), 10.44 KB, created by
Bernardo Gonzalez Kriegel
on 2020-08-12 16:07:08 UTC
(
hide
)
Description:
Bug 24973: Load custom localization file
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2020-08-12 16:07:08 UTC
Size:
10.44 KB
patch
obsolete
>From b7d69d4fe90f64ca6435d33721ca63856dde1bdb Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Fri, 15 May 2020 18:11:16 -0300 >Subject: [PATCH] Bug 24973: Load custom localization file > >It adds a new localization directory that could >host a custom SQL file for each language, >xx-YY/custom.sql > >This will be the last file to be loaded at >install time, it can be used to set any difference >from default values. > >It can't be deselected at install time. > >Moved corresponding files for de-DE, it-IT, >nb-NO and completed es-ES > >To test: >1) Apply the patch >2) Install es-ES/de-DE/it-IT/nb-NO translation (any lang) > ( cd misc/translation; ./translate install es-ES ) >3) Do a clean install using es-ES >4) After all files have been loaded check: > * A new section labeled "Localization data added" > with one file, custom.sql > * Inspect the value of FrameworksLoaded syspref, > last entry must be custom.sql >5) Remove/rename the file or localization dir and > repeat 3/4, install must proceed normally >--- > C4/Installer.pm | 8 ++++- > .../de-DE/custom.sql} | 2 +- > .../de-DE/custom.txt} | 0 > .../data/mysql/localization/es-ES/custom.sql | 29 +++++++++++++++++++ > .../it-IT/custom.sql} | 1 - > .../nb-NO/custom.sql} | 0 > .../data/mysql/localization/nb-NO/custom.txt | 1 + > .../1-Obligatorisk/system_preferences.txt | 1 - > installer/install.pl | 5 +++- > .../prog/en/modules/installer/step3.tt | 2 ++ > 10 files changed, 44 insertions(+), 5 deletions(-) > rename installer/data/mysql/{de-DE/mandatory/system_preferences.sql => localization/de-DE/custom.sql} (98%) > rename installer/data/mysql/{de-DE/mandatory/system_preferences.txt => localization/de-DE/custom.txt} (100%) > create mode 100644 installer/data/mysql/localization/es-ES/custom.sql > rename installer/data/mysql/{it-IT/necessari/system_preferences.sql => localization/it-IT/custom.sql} (99%) > rename installer/data/mysql/{nb-NO/1-Obligatorisk/system_preferences.sql => localization/nb-NO/custom.sql} (100%) > create mode 100644 installer/data/mysql/localization/nb-NO/custom.txt > delete mode 100644 installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.txt > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index db247e5243..3624d13226 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -312,6 +312,7 @@ moved to a different method. > > sub load_sql_in_order { > my $self = shift; >+ my $langchoice = shift; > my $all_languages = shift; > my @sql_list = @_; > >@@ -346,13 +347,18 @@ sub load_sql_in_order { > push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/account_offset_types.sql"; > push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/account_credit_types.sql"; > push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/account_debit_types.sql"; >+ my $localization_file = C4::Context->config('intranetdir') . >+ "/installer/data/$self->{dbms}/localization/$langchoice/custom.sql"; >+ if ( $langchoice ne 'en' and -f $localization_file ) { >+ push @fnames, $localization_file; >+ } > foreach my $file (@fnames) { > # warn $file; > undef $/; > my $error = $self->load_sql($file); > my @file = split qr(\/|\\), $file; > $lang = $file[ scalar(@file) - 3 ] unless ($lang); >- my $level = $file[ scalar(@file) - 2 ]; >+ my $level = ( $file =~ /(localization)/ ) ? $1 : $file[ scalar(@file) - 2 ]; > unless ($error) { > $systempreference .= "$file[scalar(@file)-1]|" > unless ( index( $systempreference, $file[ scalar(@file) - 1 ] ) >= 0 ); >diff --git a/installer/data/mysql/de-DE/mandatory/system_preferences.sql b/installer/data/mysql/localization/de-DE/custom.sql >similarity index 98% >rename from installer/data/mysql/de-DE/mandatory/system_preferences.sql >rename to installer/data/mysql/localization/de-DE/custom.sql >index 2692f02b02..d32b94669c 100644 >--- a/installer/data/mysql/de-DE/mandatory/system_preferences.sql >+++ b/installer/data/mysql/localization/de-DE/custom.sql >@@ -26,7 +26,7 @@ UPDATE systempreferences SET value = 'z' WHERE variable = 'DefaultClassification > UPDATE systempreferences SET value = 'Willkommen im Koha-Katalog!' WHERE variable = 'OpacMainUserBlock'; > UPDATE systempreferences SET value = '' WHERE variable = 'OpacNav'; > UPDATE systempreferences SET value = '' WHERE variable = 'OpacNavBottom'; >-UPDATE systempreferences SET value = >+UPDATE systempreferences SET value = > '<li><a href="https://worldcat.org/search?q={TITLE}" target="_blank">Andere Bibliotheken (WorldCat)</a></li> > <li><a href="https://scholar.google.com/scholar?q={TITLE}" target="_blank">Google Scholar</a></li> > <li><a href="https://www.bookfinder.com/search/?author={AUTHOR}&title={TITLE}&st=xl&ac=qr" target="_blank">Online-Buchhandel (Bookfinder.com)</a></li>' >diff --git a/installer/data/mysql/de-DE/mandatory/system_preferences.txt b/installer/data/mysql/localization/de-DE/custom.txt >similarity index 100% >rename from installer/data/mysql/de-DE/mandatory/system_preferences.txt >rename to installer/data/mysql/localization/de-DE/custom.txt >diff --git a/installer/data/mysql/localization/es-ES/custom.sql b/installer/data/mysql/localization/es-ES/custom.sql >new file mode 100644 >index 0000000000..d92556741c >--- /dev/null >+++ b/installer/data/mysql/localization/es-ES/custom.sql >@@ -0,0 +1,29 @@ >+-- >+-- System preferences that differ from the global defaults >+-- >+-- 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 3 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, see <http://www.gnu.org/licenses>. >+ >+UPDATE systempreferences SET value = 'padre|madre' WHERE variable = 'borrowerRelationship'; >+UPDATE systempreferences SET value = 'Sr.|Sra.' WHERE variable = 'BorrowersTitles'; >+UPDATE systempreferences SET value = 'FR' WHERE variable = 'CurencyFormat'; >+UPDATE systempreferences SET value = 'US' WHERE variable = 'AddressFormat'; >+UPDATE systempreferences SET value = 'metric' WHERE variable = 'dateformat'; >+UPDATE systempreferences SET value = 'ddc' WHERE variable = 'DefaultClassificationSource'; >+UPDATE systempreferences SET value = 'Bienvenido al catálogo!' WHERE variable = 'OpacMainUserBlock'; >+UPDATE systempreferences SET value = '' WHERE variable = 'OpacNav'; >+UPDATE systempreferences SET value = '' WHERE variable = 'OpacNavBottom'; >+UPDATE systempreferences SET value = '1' WHERE variable = 'CalendarFirstDayOfWeek'; >+UPDATE systempreferences SET value = '1' WHERE variable = 'opaclanguagesdisplay'; >diff --git a/installer/data/mysql/it-IT/necessari/system_preferences.sql b/installer/data/mysql/localization/it-IT/custom.sql >similarity index 99% >rename from installer/data/mysql/it-IT/necessari/system_preferences.sql >rename to installer/data/mysql/localization/it-IT/custom.sql >index fb9d619403..90d0b6d2aa 100644 >--- a/installer/data/mysql/it-IT/necessari/system_preferences.sql >+++ b/installer/data/mysql/localization/it-IT/custom.sql >@@ -62,4 +62,3 @@ UPDATE systempreferences SET value = '1' WHERE variable = 'UseICU'; > UPDATE systempreferences SET value = 'URLLinkText' WHERE variable = 'URLLinkText'; > > UPDATE systempreferences SET value = '#200|<span style=\"font-weight:bold\">|{200a}{. 200c}{ : 200e}{200d}{ / 200f}{ ; 200g}{. 200h}{. 200i}|</span>\r\n#210|. – |{210a}{ : 210c}{, 210d}|\r\n#215|. – |{215a}{ ; 215d}|\r\n#225|. – |{(225a}{ ; 225v)}|\r\n#010|. – |{ISBN 010a}|' WHERE variable = 'ISBD'; >- >diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.sql b/installer/data/mysql/localization/nb-NO/custom.sql >similarity index 100% >rename from installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.sql >rename to installer/data/mysql/localization/nb-NO/custom.sql >diff --git a/installer/data/mysql/localization/nb-NO/custom.txt b/installer/data/mysql/localization/nb-NO/custom.txt >new file mode 100644 >index 0000000000..66c4837276 >--- /dev/null >+++ b/installer/data/mysql/localization/nb-NO/custom.txt >@@ -0,0 +1 @@ >+Standard systempreferanser. >diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.txt b/installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.txt >deleted file mode 100644 >index 20f07c834e..0000000000 >--- a/installer/data/mysql/nb-NO/1-Obligatorisk/system_preferences.txt >+++ /dev/null >@@ -1 +0,0 @@ >-Standard systempreferanser. >diff --git a/installer/install.pl b/installer/install.pl >index 041438160a..350562d413 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -245,9 +245,12 @@ elsif ( $step && $step == 3 ) { > elsif ( $op && $op eq 'addframeworks' ) { > > # 1ST install, 3rd sub-step : insert the SQL files the user has selected >+ my $langchoice = $query->param('fwklanguage'); >+ $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice); >+ $langchoice =~ s/[^a-zA-Z_-]*//g; > > my ( $fwk_language, $list ) = >- $installer->load_sql_in_order( $all_languages, >+ $installer->load_sql_in_order( $langchoice, $all_languages, > $query->multi_param('framework') ); > $template->param( > "fwklanguage" => $fwk_language, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >index b89d236b16..685fd7f116 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >@@ -173,6 +173,8 @@ > <h3>Optional data added</h3> > [% ELSIF lis.level == 'mysql' %] > <h3>MySQL data added</h3> >+ [% ELSIF lis.level == 'localization' %] >+ <h3>Localization data added</h3> > [% ELSE %] > <h3>[% lis.level FILTER ucfirst | html %] data added</h3> > [% END %] >-- >2.17.1
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 24973
:
103071
|
103072
|
103073
|
103074
|
103075
|
104971
|
105032
|
108130
|
108166
|
108946