From f1d399e48ef0c33018fe0f95fba3f93b6c243103 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 23 Oct 2010 14:50:41 -0400 Subject: [PATCH] Update language mappings to fix Bug 5311 Content-Type: text/plain; charset="utf-8" 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. --- .../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', 'Հայերէն'); @@ -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ç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', 'ພາສາລາວ'); @@ -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', 'српски'); @@ -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 400fef7..3b34520 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3744,6 +3744,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.1