@@ -, +, @@ --- C4/Installer.pm | 26 ++++++++++++++++++++++++++ installer/install.pl | 5 +++++ 2 files changed, 31 insertions(+) --- a/C4/Installer.pm +++ a/C4/Installer.pm @@ -447,6 +447,32 @@ sub set_version_syspref { C4::Context->clear_syspref_cache(); } +=head2 set_languages_syspref + + $installer->set_languages_syspref(); + +Add the installation language to 'language' and 'opaclanguages' system preferences +if different from 'en' + +=cut + +sub set_languages_syspref { + my $self = shift; + my $language = shift; + + return if ( not $language or $language eq 'en' ); + + warn "UPDATE Languages"; + # intranet + my $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='language'"); + $pref->execute("en,$language"); + # opac + $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='opaclanguages'"); + $pref->execute("en,$language"); + + C4::Context->clear_syspref_cache(); +} + =head2 load_sql my $error = $installer->load_sql($filename); --- a/installer/install.pl +++ a/installer/install.pl @@ -230,6 +230,11 @@ elsif ( $step && $step == 3 ) { elsif ( $op && $op eq 'finish' ) { $installer->set_version_syspref(); + my $langchoice = $query->param('fwklanguage'); + $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice); + $langchoice =~ s/[^a-zA-Z_-]*//g; + $installer->set_languages_syspref($langchoice); + # Installation is finished. # We just deny anybody access to install # And we redirect people to mainpage. --