@@ -, +, @@ --- .../intranet-tmpl/prog/en/xslt/MARC21Languages.xsl | 498 +++++++++++++++++++++ .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 1 + .../prog/en/xslt/MARC21slim2intranetResults.xsl | 2 + .../intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 54 ++- misc/maintenance/generate_MARC21Languages.pl | 142 ++++++ 5 files changed, 696 insertions(+), 1 deletion(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21Languages.xsl create mode 100755 misc/maintenance/generate_MARC21Languages.pl --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21Languages.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21Languages.xsl @@ -0,0 +1,498 @@ + +]> + + + + + + Abkhaz + Achinese + Acoli + Adangme + Adygei + Afar + Afrihili (Artificial language) + Afrikaans + Afroasiatic (Other) + Ainu + Akan + Akkadian + Albanian + Aleut + Algonquian (Other) + Altai + Altaic (Other) + Amharic + Angika + Apache languages + Arabic + Aragonese + Aramaic + Arapaho + Arawak + Armenian + Aromanian + Artificial (Other) + Assamese + Athapascan (Other) + Australian languages + Austronesian (Other) + Avaric + Avestan + Awadhi + Aymara + Azerbaijani + Bable + Balinese + Baltic (Other) + Baluchi + Bambara + Bamileke languages + Banda languages + Bantu (Other) + Basa + Bashkir + Basque + Batak + Beja + Belarusian + Bemba + Bengali + Berber (Other) + Bhojpuri + Bihari (Other) + Bikol + Bilin + Bislama + Blissymbolics + Bosnian + Braj + Breton + Bugis + Bulgarian + Buriat + Burmese + Caddo + Carib + Catalan + Caucasian (Other) + Cebuano + Celtic (Other) + Central American Indian (Other) + Chagatai + Chamic languages + Chamorro + Chechen + Cherokee + Cheyenne + Chibcha + Chinese + Chinook jargon + Chipewyan + Choctaw + Church Slavic + Chuukese + Chuvash + Coptic + Cornish + Corsican + Cree + Creek + Creoles and Pidgins (Other) + Creoles and Pidgins, English-based (Other) + Creoles and Pidgins, French-based (Other) + Creoles and Pidgins, Portuguese-based (Other) + Crimean Tatar + Croatian + Cushitic (Other) + Czech + Dakota + Danish + Dargwa + Dayak + Delaware + Dinka + Divehi + Dogri + Dogrib + Dravidian (Other) + Duala + Dutch + Dutch, Middle (ca. 1050-1350) + Dyula + Dzongkha + East Frisian + Edo + Efik + Egyptian + Ekajuk + Elamite + English + English, Middle (1100-1500) + English, Old (ca. 450-1100) + Erzya + Esperanto + Estonian + Ethiopic + Ewe + Ewondo + Fang + Fanti + Faroese + Fijian + Filipino + Finnish + Finno-Ugrian (Other) + Fon + French + French, Middle (ca. 1300-1600) + French, Old (ca. 842-1300) + Frisian + Friulian + Fula + + Galician + Ganda + Gayo + Gbaya + Georgian + German + German, Middle High (ca. 1050-1500) + German, Old High (ca. 750-1050) + Germanic (Other) + Gilbertese + Gondi + Gorontalo + Gothic + Grebo + Greek, Ancient (to 1453) + Greek, Modern (1453- ) + Guarani + Gujarati + Gwich'in + Haida + Haitian French Creole + Hausa + Hawaiian + Hebrew + Herero + Hiligaynon + Hindi + Hiri Motu + Hittite + Hmong + Hungarian + Hupa + Iban + Icelandic + Ido + Igbo + Ijo + Iloko + Inari Sami + Indic (Other) + Indo-European (Other) + Indonesian + Ingush + Interlingua (International Auxiliary Language Association) + Interlingue + Inuktitut + Inupiaq + Iranian (Other) + Irish + Irish, Middle (ca. 1100-1550) + Irish, Old (to 1100) + Iroquoian (Other) + Italian + Japanese + Javanese + Judeo-Arabic + Judeo-Persian + Kabardian + Kabyle + Kachin + Kalâtdlisut + Kamba + Kannada + Kanuri + Karachay-Balkar + Kara-Kalpak + Karelian + Karen languages + Kashmiri + Kashubian + Kawi + Kazakh + Khasi + Khmer + Khoisan (Other) + Khotanese + Kikuyu + Kimbundu + Kinyarwanda + Klingon (Artificial language) + Komi + Kongo + Konkani + Kootenai + Korean + Kosraean + Kpelle + Kru (Other) + Kuanyama + Kumyk + Kurdish + Kurukh + Kyrgyz + Ladino + Lahndā + Lamba (Zambia and Congo) + Lao + Latin + Latvian + Lezgian + Limburgish + Lingala + Lithuanian + Lojban (Artificial language) + Low German + Lower Sorbian + Lozi + Luba-Katanga + Luba-Lulua + Luiseño + Lule Sami + Lunda + Luo (Kenya and Tanzania) + Lushai + Luxembourgish + Macedonian + Madurese + Magahi + Maithili + Makasar + Malagasy + Malay + Malayalam + Maltese + Manchu + Mandar + Mandingo + Manipuri + Manobo languages + Manx + Maori + Mapuche + Marathi + Mari + Marshallese + Marwari + Maasai + Mayan languages + Mende + Micmac + Minangkabau + Mirandese + Miscellaneous languages + Mohawk + Moksha + Mon-Khmer (Other) + Mongo-Nkundu + Mongolian + Montenegrin + Mooré + Multiple languages + Munda (Other) + Nahuatl + Nauru + Navajo + Ndebele (South Africa) + Ndebele (Zimbabwe) + Ndonga + Neapolitan Italian + Nepali + Newari + Newari, Old + Nias + Niger-Kordofanian (Other) + Nilo-Saharan (Other) + Niuean + N'Ko + Nogai + No linguistic content + North American Indian (Other) + North Frisian + Northern Sami + Northern Sotho + Norwegian + Norwegian (Bokmål) + Norwegian (Nynorsk) + Nubian languages + Nyamwezi + Nyanja + Nyankole + Nyoro + Nzima + Occitan (post-1500) + Oirat + Ojibwa + Old Norse + Old Persian (ca. 600-400 B.C.) + Oriya + Oromo + Osage + Ossetic + Otomian languages + Pahlavi + Palauan + Pali + Pampanga + Pangasinan + Panjabi + Papiamento + Papuan (Other) + Persian + Philippine (Other) + Phoenician + Pohnpeian + Polish + Portuguese + Prakrit languages + Provençal (to 1500) + Pushto + Quechua + Raeto-Romance + Rajasthani + Rapanui + Rarotongan + Romance (Other) + Romani + Romanian + Rundi + Russian + Salishan languages + Samaritan Aramaic + Sami + Samoan + Sandawe + Sango (Ubangi Creole) + Sanskrit + Santali + Sardinian + Sasak + Scots + Scottish Gaelic + Selkup + Semitic (Other) + Serbian + Serer + Shan + Shona + Sichuan Yi + Sicilian Italian + Sidamo + Sign languages + Siksika + Sindhi + Sinhalese + Sino-Tibetan (Other) + Siouan (Other) + Skolt Sami + Slavey + Slavic (Other) + Slovak + Slovenian + Sogdian + Somali + Songhai + Soninke + Sorbian (Other) + Sotho + South American Indian (Other) + Southern Sami + Spanish + Sranan + Sukuma + Sumerian + Sundanese + Susu + Swahili + Swazi + Swedish + Swiss German + Syriac + Syriac, Modern + Tagalog + Tahitian + Tai (Other) + Tajik + Tamashek + Tamil + Tatar + Telugu + Temne + Terena + Tetum + Thai + Tibetan + Tigré + Tigrinya + Tiv + Tlingit + Tok Pisin + Tokelauan + Tonga (Nyasa) + Tongan + Tsimshian + Tsonga + Tswana + Tumbuka + Tupi languages + Turkish + Turkish, Ottoman + Turkmen + Tuvaluan + Tuvinian + Twi + Udmurt + Ugaritic + Uighur + Ukrainian + Umbundu + Undetermined + Upper Sorbian + Urdu + Uzbek + Vai + Venda + Vietnamese + Volapük + Votic + Wakashan languages + Walloon + Waray + Washoe + Welsh + Western Pahari languages + Wolayta + Wolof + Xhosa + Yakut + Yao (Africa) + Yapese + Yiddish + Yoruba + Yupik languages + Zande languages + Zapotec + Zaza + Zenaga + Zhuang + Zulu + Zuni + + Unknown language code + + + + --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -174,6 +174,7 @@ + --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl @@ -826,6 +826,8 @@ + + --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -5,6 +5,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="marc"> + @@ -349,7 +350,58 @@ - + + + + + + + + + + Language: + + + + Summary language: + + + + Spoken language: + + + + Original language: + + + + Subtitle language: + + + + + + + + + + + + + + + lang_code- + + + + + , + + + + . + + --- a/misc/maintenance/generate_MARC21Languages.pl +++ a/misc/maintenance/generate_MARC21Languages.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl +# +# Copyright (C) 2018 Koha-Suomi Oy +# +# This file is part of Koha +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . +# + +use Modern::Perl; +use XML::Simple; +use Pod::Usage; +use Getopt::Long; +use Carp; + +use open ':std', ':encoding(UTF-8)'; + +sub usage { + pod2usage( -verbose => 2 ); + exit; +} + +# Options +my $sourceurl = 'http://www.loc.gov/standards/codelists/languages.xml'; +my $help; +my $outfile; +my $tempfile = '/tmp/languages.xml'; + +GetOptions( + 'o|output:s' => \$outfile, + 'url:s' => \$sourceurl, + 'help|h' => \$help, +); + +usage() if $help; + +system( qq{/usr/bin/wget $sourceurl -O $tempfile } ) == 0 + or croak "Can't wget $sourceurl ($?)"; + +my $ref = XMLin($tempfile); +my $languages = $ref->{'languages'}->{'language'}; + +# output log or STDOUT +my $out_handle; +if (defined $outfile) { + open( $out_handle, ">", $outfile ) || croak("Cannot open output file"); +} else { + open( $out_handle, ">&STDOUT" ) || croak("Couldn't duplicate STDOUT: $!"); +} +generate_header($out_handle); +generate_body($out_handle, $languages); +generate_footer($out_handle); +close $out_handle; + + +sub generate_body { + my ( $file_handle, $language_list ) = @_; + + foreach my $l ( @{$language_list} ) { + my $code = $l->{'code'}; + my $name = ( + ref( $l->{'name'} ) eq 'HASH' + ? $l->{'name'}{'content'} + : $l->{'name'} + ); + next if ( ref($code) eq 'HASH' && $code->{'status'} eq 'obsolete' ); + print {$file_handle} " "; + print {$file_handle} "$name"; + print {$file_handle} ""; + print {$file_handle} "\n"; + } + return; +} + +sub generate_header { + my ($file_handle) = @_; + print {$file_handle} <<"HEADER"; + +]> + + + + + +HEADER + return; +} + +sub generate_footer { + my ($file_handle) = @_; + print {$file_handle} <<"FOOTER"; + + Unknown language code + + + + +FOOTER + return; +} + +=head1 NAME + +generate_MARC21Languages.pl + +=head1 SYNOPSIS + + generate_MARC21Languages.pl + generate_MARC21Languages.pl --url='http://www.loc.gov/standards/codelists/languages.xml' + +=head1 DESCRIPTION + +Create MARC21Languages.xsl from the loc.gov MARC21 Code List for Languages + +=over 8 + +=item B<--help> + +Prints this help + +=item B<--url> + +Fetch the languages XML from this url. Defaults to http://www.loc.gov/standards/codelists/languages.xml + +=item B<--output> + +Writes the output XML into this file. Defaults to STDOUT. + +=back + +=cut --