[Koha-patches] [PATCH 1/3] [SIGNED-OFF] Update language mappings to fix Bug 5311

Galen Charlton gmcharlt at gmail.com
Sat Oct 30 05:49:13 CEST 2010


From: Jared Camins-Esakov <jcamins at cpbibliography.com>

This patch updates the language_rfc4646_to_iso639 mapping table with the
correct mappings for several languages that were not mapped correctly to
the codes used in MARC, including Finnish (which was not mapped at all),
and Armenian (which was mapped to an obsolete code). This patch also
changes English and French to use the proper three-letter codes, which
will eliminate false positives when, for example, limiting by French
brings up results in Afrikaans.

This patch adds the changes to the updatedatabase.pl script, and removes
the incorrectly specified DBversion in the previous patch.

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 .../data/mysql/en/mandatory/subtag_registry.sql    |   30 ++++++++++++++------
 installer/data/mysql/updatedatabase.pl             |   16 ++++++++++
 2 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/installer/data/mysql/en/mandatory/subtag_registry.sql b/installer/data/mysql/en/mandatory/subtag_registry.sql
index f2e0648..852805d 100644
--- a/installer/data/mysql/en/mandatory/subtag_registry.sql
+++ b/installer/data/mysql/en/mandatory/subtag_registry.sql
@@ -68,7 +68,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'hy', 'language', 'Armenian','2005-10-16');
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'hy','hy');
+VALUES( 'hy','arm');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES ( 'hy', 'language', 'hy', '&#1344;&#1377;&#1397;&#1381;&#1408;&#1383;&#1398;');
@@ -164,7 +164,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'en', 'language', 'English','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'en','en');
+VALUES( 'en','eng');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'en', 'language', 'en', 'English');
@@ -172,10 +172,13 @@ VALUES( 'en', 'language', 'en', 'English');
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'en', 'language', 'fr', 'Anglais');
 
--- English
+-- Finnish
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'fi', 'language', 'Finnish','2005-10-16' );
 
+INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
+VALUES( 'fi','fin');
+
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'fi', 'language', 'fi', 'suomi');
 
@@ -187,7 +190,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'fr', 'language', 'French','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'fr','fr');
+VALUES( 'fr','fre');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'fr', 'language', 'en', 'French');
@@ -202,8 +205,8 @@ VALUES( 'fr', 'language', 'fr', 'Fran&ccedil;ais');
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'lo', 'language', 'Lao','2005-10-16' );
 
--- INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
--- VALUES( 'lo','nor'); ???
+INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
+VALUES( 'lo','lao');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'lo', 'language', 'lo', '&#3742;&#3762;&#3754;&#3762;&#3749;&#3762;&#3751;');
@@ -312,7 +315,7 @@ INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'it', 'language', 'Italian','2005-10-16' );
 
 INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
-VALUES( 'it','ind');
+VALUES( 'it','ita');
 
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'it', 'language', 'it', 'Italiano');
@@ -371,7 +374,7 @@ VALUES( 'la', 'language', 'en', 'Latin');
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'la', 'language', 'fr', 'Latin');
 
--- Galacian
+-- Galician
 
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'gl', 'language', 'Galician','2005-10-16' );
@@ -485,6 +488,9 @@ VALUES( 'ru', 'language', 'fr', 'Russe');
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'sr', 'language', 'Serbian','2005-10-16' );
 
+INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
+VALUES( 'sr','srp');
+
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'sr', 'language', 'sr', '&#1089;&#1088;&#1087;&#1089;&#1082;&#1080;');
 
@@ -527,6 +533,9 @@ VALUES( 'sv', 'language', 'fr', 'Suédois');
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'tet', 'language', 'Tetum','2005-10-16' );
 
+INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
+VALUES( 'tet','tet');
+
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'tet', 'language', 'tet', 'tetun');
 
@@ -582,10 +591,13 @@ VALUES( 'uk', 'language', 'en', 'Ukranian');
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'uk', 'language', 'fr', 'Ukrainien');
 
--- English
+-- Urdu
 INSERT INTO language_subtag_registry( subtag, type, description, added)
 VALUES ( 'ur', 'language', 'Urdu','2005-10-16' );
 
+INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
+VALUES( 'ur','urd');
+
 INSERT INTO language_descriptions(subtag, type, lang, description)
 VALUES( 'ur', 'language', 'en', 'Urdu');
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 523c533..9b1ed15 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3799,6 +3799,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.03.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("UPDATE language_rfc4646_to_iso639 SET iso639_2_code='arm' WHERE rfc4646_subtag='hy';");
+    $dbh->do("UPDATE language_rfc4646_to_iso639 SET iso639_2_code='eng' WHERE rfc4646_subtag='en';");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'fi','fin');");
+    $dbh->do("UPDATE language_rfc4646_to_iso639 SET iso639_2_code='fre' WHERE rfc4646_subtag='fr';");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'lo','lao');");
+    $dbh->do("UPDATE language_rfc4646_to_iso639 SET iso639_2_code='it' WHERE rfc4646_subtag='ita';");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'sr','srp');");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'tet','tet');");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'ur','urd');");
+
+    print "Upgrade to $DBversion done (Correct language mappings)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.7.0



More information about the Koha-patches mailing list