[Koha-patches] [PATCH] Update language mappings to fix Bug 5311

Jared Camins-Esakov jcamins at cpbibliography.com
Sat Oct 30 05:07:15 CEST 2010


Ignore this patch, and the previous patch for this bug. I will send the
correct patch in just a moment.

On Fri, Oct 29, 2010 at 11:09 PM, Jared Camins-Esakov <
jcamins at cpbibliography.com> wrote:

> 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.
> ---
>  .../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.plb/installer/data/mysql/
> updatedatabase.pl
> index 400fef7..89517c6 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.001';
> +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
>
>


-- 
Jared Camins-Esakov
Freelance bibliographer, C & P Bibliography Services, LLC
(phone) +1 (917) 727-3445
(e-mail) jcamins at cpbibliography.com
(web) http://www.cpbibliography.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20101029/cb00b144/attachment.htm>


More information about the Koha-patches mailing list