[Koha-patches] [PATCH] Fix for Bug 3730 - Wrong ISO 639-2 Language Code for Portuguese in database

Ricardo Dias Marques koha at ricmarques.net
Fri Oct 23 22:16:03 CEST 2009


Fix for:

Bug 3730 - Wrong ISO 639-2 Language Code for Portuguese in database
http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3730

For 3.0.x head of the Git branch, the ISO 639-2 Language Code for
Portuguese in Koha database is wrong.

Specifically, in the table "language_rfc4646_to_iso639", when the
field "rfc4646_subtag" has the value "pt", the field "iso639_2_code"
should have the value of "por" and NOT the current one of "pol"
("pol" refers to "Polish" as correctly also appears for the code "pl",
in the row above the "pt" one).

In my test setups, this showed some serious sequences for people
that choose the Portuguese language in the Web Installer, namely:
- very weird look of Staff client with missing Header and Footer,
that renders the Staff client unusable
- Portuguese translation apparently not getting updated for the OPAC
(for people that do an Upgrade from a previous version)

This patch is for the 3.0.x branch (I tested it with that branch).

For the master branch, I don't have a database setup to create and
test a similar patch but Chris Cormack nicely volunteered to do that.
Thanks Chris!
---
 .../data/mysql/en/mandatory/subtag_registry.sql    |    2 +-
 .../mysql/fr-FR/1-Obligatoire/subtag_registry.sql  |    2 +-
 .../data/mysql/ru-RU/mandatory/subtag_registry.sql |    2 +-
 .../data/mysql/uk-UA/mandatory/subtag_registry.sql |    2 +-
 installer/data/mysql/updatedatabase.pl             |    8 ++++++++
 kohaversion.pl                                     |    2 +-
 6 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/installer/data/mysql/en/mandatory/subtag_registry.sql b/installer/data/mysql/en/mandatory/subtag_registry.sql
index bb7274a..f2e0648 100644
--- a/installer/data/mysql/en/mandatory/subtag_registry.sql
+++ b/installer/data/mysql/en/mandatory/subtag_registry.sql
@@ -438,7 +438,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'pt', 'language', 'Portuguese','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'pt','pol');
+VALUES( 'pt','por');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'pt', 'language', 'pt', 'Português');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/subtag_registry.sql b/installer/data/mysql/fr-FR/1-Obligatoire/subtag_registry.sql
index 08d6d09..0f298c3 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/subtag_registry.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/subtag_registry.sql
@@ -385,7 +385,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'pt', 'language', 'Portuguese','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'pt','pol');
+VALUES( 'pt','por');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'pt', 'language', 'pt', 'Português');
diff --git a/installer/data/mysql/ru-RU/mandatory/subtag_registry.sql b/installer/data/mysql/ru-RU/mandatory/subtag_registry.sql
index bb7274a..f2e0648 100644
--- a/installer/data/mysql/ru-RU/mandatory/subtag_registry.sql
+++ b/installer/data/mysql/ru-RU/mandatory/subtag_registry.sql
@@ -438,7 +438,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'pt', 'language', 'Portuguese','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'pt','pol');
+VALUES( 'pt','por');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'pt', 'language', 'pt', 'Português');
diff --git a/installer/data/mysql/uk-UA/mandatory/subtag_registry.sql b/installer/data/mysql/uk-UA/mandatory/subtag_registry.sql
index bb7274a..f2e0648 100644
--- a/installer/data/mysql/uk-UA/mandatory/subtag_registry.sql
+++ b/installer/data/mysql/uk-UA/mandatory/subtag_registry.sql
@@ -438,7 +438,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'pt', 'language', 'Portuguese','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'pt','pol');
+VALUES( 'pt','por');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'pt', 'language', 'pt', 'Português');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 1183375..6d2e968 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1959,6 +1959,14 @@ END_SQL
     print "Upgrade to $DBversion done (warning added to OPACShelfBrowser system preference)\n";
     SetVersion ($DBversion);
 }
+
+$DBversion = "3.00.00.108";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("UPDATE language_rfc4646_to_iso639 SET iso639_2_code = 'por' WHERE rfc4646_subtag='pt' ");
+    print "Upgrade to $DBversion done (corrected ISO 639-2 language code for Portuguese)\n";
+    SetVersion ($DBversion);
+}
+
 if (C4::Context->preference("Version") =~/3\.00/) {
         my $perllibdir=C4::Context->config('intranetdir');
 	my $return=do qq($perllibdir/installer/data/mysql/updatedatabase30.pl);
diff --git a/kohaversion.pl b/kohaversion.pl
index 62e0770..ddb6e97 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.00.04.019';
+    our $VERSION = '3.00.04.020';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.6.5




More information about the Koha-patches mailing list