From 9a71157ceb3a2c9b60df05a5d4c167a3c57375a1 Mon Sep 17 00:00:00 2001 From: dbs Date: Sun, 5 Jul 2009 05:28:40 +0000 Subject: [PATCH] Fix SQL translation script and associated unit tests It looks like polib became stricter about forcing the line number portion of filename:line occurrences in the PO to actually be an integer, with the result of simply concatenating the text "line numbers" that we had been using to store ID values to the table names. Now we're using specially formatted translator comments to hold the ID values, and using the filename:line occurence entries to actually hold the source filename and line number for occurrences. Fancy that! git-svn-id: svn://svn.open-ils.org/ILS/trunk@13500 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- build/i18n/scripts/db-seed-i18n.py | 21 ++- build/i18n/tests/data/po2sql.sql | 44 ++++-- build/i18n/tests/data/sql2pot.pot | 179 ++++++++++++++++++++---- build/i18n/tests/data/sqlsource.po | 209 ++++++++++++++++++++++------ build/i18n/tests/data/sqlsource.sql | 148 ++++++++++++++------ 5 files changed, 465 insertions(+), 136 deletions(-) diff --git a/build/i18n/scripts/db-seed-i18n.py b/build/i18n/scripts/db-seed-i18n.py index 865700c57a..82df1349d9 100755 --- a/build/i18n/scripts/db-seed-i18n.py +++ b/build/i18n/scripts/db-seed-i18n.py @@ -22,6 +22,7 @@ import optparse import polib import re import sys +import os.path class SQL(basel10n.BaseL10N): """ @@ -80,14 +81,16 @@ class SQL(basel10n.BaseL10N): occurid = re.compile(r':').sub("%3A", fi18n.group('id')) if (msgid in serts): - serts[msgid].occurrences.append((fq_field, occurid)) + serts[msgid].occurrences.append((os.path.basename(source), num)) + serts[msgid].tcomment = ' '.join((serts[msgid].tcomment, 'id::%s__%s' % (fq_field, occurid))) else: poe = polib.POEntry() - poe.occurrences = [(fq_field, occurid)] + poe.tcomment = 'id::%s__%s' % (fq_field, occurid) + poe.occurrences = [(os.path.basename(source), num)] poe.msgid = msgid serts[msgid] = poe - except: - print "Error in line %d of SQL source file" % (num) + except Exception as exc: + print "Error in line %d of SQL source file: %s" % (num, exc) for poe in serts.values(): self.pot.append(poe) @@ -100,18 +103,22 @@ class SQL(basel10n.BaseL10N): insert = "INSERT INTO config.i18n_core (fq_field, identity_value," \ " translation, string) VALUES ('%s', '%s', '%s', '%s');" + idregex = re.compile(r'^id::(?P.*?)__(?P.*?)$') for entry in self.pot: - for fq_field in entry.occurrences: + for id_value in entry.tcomment.split(): # Escape SQL single-quotes to avoid b0rkage msgstr = re.compile(r'\'').sub("''", entry.msgstr) + identifier = idregex.search(id_value) + if identifier is None: + continue # And unescape any colons in the occurence ID - occurid = re.compile(r'%3A').sub(':', fq_field[1]) + occurid = re.compile(r'%3A').sub(':', identifier.group('id')) if msgstr == '': # Don't generate a stmt for an untranslated string break - self.sql.append(insert % (fq_field[0], occurid, locale, msgstr)) + self.sql.append(insert % (identifier.group('class'), occurid, locale, msgstr)) def main(): """ diff --git a/build/i18n/tests/data/po2sql.sql b/build/i18n/tests/data/po2sql.sql index a2694cdbf2..dcdfbfc5b6 100644 --- a/build/i18n/tests/data/po2sql.sql +++ b/build/i18n/tests/data/po2sql.sql @@ -1,14 +1,30 @@ -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.bib_source', 'oclc', 'zz-ZZ', 'OCLC'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.bib_source', 'System Local', 'zz-ZZ', 'Lorem ipsum'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.bib_source', 'Project Gutenberg', 'zz-ZZ', 'Projekt Runeberg'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.standing', 'Good', 'zz-ZZ', 'Gut'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.standing', 'Barred', 'zz-ZZ', 'största'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Preschool', 'zz-ZZ', 'årligen'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Primary', 'zz-ZZ', 'bläddra'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Pre-adolescent', 'zz-ZZ', 'hjälp'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Adolescent', 'zz-ZZ', 'utgåvor'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Adult', 'zz-ZZ', 'öppet'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Specialized', 'zz-ZZ', 'datorföreningen'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'General', 'zz-ZZ', 'skapa'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('config.audience_map', 'Juvenile', 'zz-ZZ', 'klassisk'); -INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('asset.copy_location', 'Stacks', 'zz-ZZ', 'Linköping'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cbs.source', '2', 'zz-ZZ', 'Système local'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('crcd.name', '4', 'zz-ZZ', '3_jours_1_renouvellement'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cit.name', '3', 'zz-ZZ', 'Autre'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.name', 'fr-CA', 'zz-ZZ', 'Français (Canada)'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cbs.source', '1', 'zz-ZZ', 'oclc'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('ccpbt.label', 'staff_client', 'zz-ZZ', 'Lorem Ipsum'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cbrebt.label', 'staff_client', 'zz-ZZ', 'Lorem Ipsum'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 'd', 'zz-ZZ', 'Sous-unité'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 'b', 'zz-ZZ', 'Élément de collections'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cbs.source', '3', 'zz-ZZ', 'Project Gutenberg'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.name', 'en-US', 'zz-ZZ', 'Anglais (États-Unis)'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 'c', 'zz-ZZ', 'Collection'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 'i', 'zz-ZZ', 'Ressource intégrée'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('vqbrad.description', '4', 'zz-ZZ', 'Pagination'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cnct.name', '1', 'zz-ZZ', 'Livre de poche'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.description', 'es-US', 'zz-ZZ', 'Espagnol américain'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.name', 'en-CA', 'zz-ZZ', 'Anglais (Canada)'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.name', 'es-US', 'zz-ZZ', 'Espagnol (États-Unis)'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.description', 'en-CA', 'zz-ZZ', 'Anglais canadien'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cst.value', '2', 'zz-ZZ', 'Barré'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cst.value', '1', 'zz-ZZ', 'Bien'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('vqbrad.description', '3', 'zz-ZZ', 'Langue de l''oeuvre'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('acpl.name', '1', 'zz-ZZ', 'Piles'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.description', 'en-US', 'zz-ZZ', 'Anglais américain'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 'm', 'zz-ZZ', 'Monographie ou article'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cit.name', '1', 'zz-ZZ', 'Permis de conduire'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('vqbrad.description', '1', 'zz-ZZ', 'Auteur de l''oeuvre'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('i18n_l.description', 'fr-CA', 'zz-ZZ', 'Français canadien'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('vqbrad.description', '1', 'zz-ZZ', 'Titre de l''oeuvre'); +INSERT INTO config.i18n_core (fq_field, identity_value, translation, string) VALUES ('cblvl.value', 's', 'zz-ZZ', 'Collections'); diff --git a/build/i18n/tests/data/sql2pot.pot b/build/i18n/tests/data/sql2pot.pot index c4606c58cd..4eb2a3d6a5 100644 --- a/build/i18n/tests/data/sql2pot.pot +++ b/build/i18n/tests/data/sql2pot.pot @@ -11,62 +11,187 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" -#: config.bib_source:3 +# id::cbs.source__2 +#: sqlsource.sql:5 +msgid "System Local" +msgstr "" + +# id::crcd.name__4 +#: sqlsource.sql:63 +msgid "3_days_1_renew" +msgstr "" + +# id::cit.name__3 +#: sqlsource.sql:53 +msgid "Other" +msgstr "" + +# id::i18n_l.name__fr-CA +#: sqlsource.sql:95 +msgid "French (Canada)" +msgstr "" + +# id::cbs.source__1 +#: sqlsource.sql:3 msgid "oclc" msgstr "" -#: config.bib_source:4 -msgid "System Local" +# id::ccpbt.label__staff_client id::cbrebt.label__staff_client +#: sqlsource.sql:102 sqlsource.sql:105 +msgid "General Staff Client container" msgstr "" -#: config.bib_source:5 +# id::cblvl.value__d +#: sqlsource.sql:82 +msgid "Subunit" +msgstr "" + +# id::cblvl.value__b +#: sqlsource.sql:80 +msgid "Serial component part" +msgstr "" + +# id::crcd.name__2 +#: sqlsource.sql:59 +msgid "28_days_2_renew" +msgstr "" + +# id::crcd.name__6 +#: sqlsource.sql:67 +msgid "35_days_1_renew" +msgstr "" + +# id::cbs.source__3 +#: sqlsource.sql:7 msgid "Project Gutenberg" msgstr "" -#: config.standing:7 -msgid "Good" +# id::crcd.name__1 +#: sqlsource.sql:57 +msgid "7_days_0_renew" msgstr "" -#: config.standing:8 -msgid "Barred" +# id::i18n_l.name__en-US +#: sqlsource.sql:89 +msgid "English (US)" +msgstr "" + +# id::ccpbt.label__misc id::ccnbt.label__misc id::cbrebt.label__misc +#: sqlsource.sql:101 sqlsource.sql:103 sqlsource.sql:104 +msgid "Miscellaneous" +msgstr "" + +# id::cblvl.value__c +#: sqlsource.sql:81 +msgid "Collection" +msgstr "" + +# id::cblvl.value__i +#: sqlsource.sql:83 +msgid "Integrating resource" msgstr "" -#: config.audience_map:31 -msgid "Unknown or unspecified" +# id::vqbrad.description__4 +#: sqlsource.sql:78 +msgid "Pagination" msgstr "" -#: config.audience_map:32 -msgid "Preschool" +# id::cnct.name__1 +#: sqlsource.sql:45 +msgid "Paperback Book" msgstr "" -#: config.audience_map:33 -msgid "Primary" +# id::i18n_l.description__es-US +#: sqlsource.sql:99 +msgid "American Spanish" msgstr "" -#: config.audience_map:34 -msgid "Pre-adolescent" +# id::i18n_l.name__en-CA +#: sqlsource.sql:92 +msgid "English (Canada)" msgstr "" -#: config.audience_map:35 -msgid "Adolescent" +# id::i18n_l.name__es-US +#: sqlsource.sql:98 +msgid "Spanish (US)" msgstr "" -#: config.audience_map:36 -msgid "Adult" +# id::i18n_l.description__en-CA +#: sqlsource.sql:93 +msgid "Canadian English" msgstr "" -#: config.audience_map:37 -msgid "Specialized" +# id::crcd.name__3 +#: sqlsource.sql:61 +msgid "3_months_0_renew" msgstr "" -#: config.audience_map:38 -msgid "General" +# id::cst.value__2 +#: sqlsource.sql:10 +msgid "Barred" msgstr "" -#: config.audience_map:39 -msgid "Juvenile" +# id::cst.value__1 +#: sqlsource.sql:9 +msgid "Good" msgstr "" -#: asset.copy_location:48 +# id::vqbrad.description__3 +#: sqlsource.sql:77 +msgid "Language of work" +msgstr "" + +# id::acpl.name__1 +#: sqlsource.sql:72 msgid "Stacks" msgstr "" + +# id::i18n_l.description__en-US +#: sqlsource.sql:90 +msgid "American English" +msgstr "" + +# id::crcd.name__7 +#: sqlsource.sql:69 +msgid "7_days_2_renew" +msgstr "" + +# id::cblvl.value__m +#: sqlsource.sql:84 +msgid "Monograph/Item" +msgstr "" + +# id::cit.name__1 +#: sqlsource.sql:49 +msgid "Drivers License" +msgstr "" + +# id::vqbrad.description__1 +#: sqlsource.sql:76 +msgid "Author of work" +msgstr "" + +# id::i18n_l.description__fr-CA +#: sqlsource.sql:96 +msgid "Canadian French" +msgstr "" + +# id::vqbrad.description__1 +#: sqlsource.sql:75 +msgid "Title of work" +msgstr "" + +# id::cit.name__2 +#: sqlsource.sql:51 +msgid "SSN" +msgstr "" + +# id::cblvl.value__s +#: sqlsource.sql:85 +msgid "Serial" +msgstr "" + +# id::crcd.name__5 +#: sqlsource.sql:65 +msgid "2_months_2_renew" +msgstr "" diff --git a/build/i18n/tests/data/sqlsource.po b/build/i18n/tests/data/sqlsource.po index 6bed8f70f3..31d698a865 100644 --- a/build/i18n/tests/data/sqlsource.po +++ b/build/i18n/tests/data/sqlsource.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Evergreen 1.4\n" "Report-Msgid-Bugs-To: open-ils-dev@list.georgialibraries.org\n" -"POT-Creation-Date: 1999-12-31 23:59:59 -0400\n" +"POT-Creation-Date: "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -11,62 +11,187 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" -#: config.bib_source:3 +# id::cbs.source__2 +#: sqlsource.sql:5 +msgid "System Local" +msgstr "Système local" + +# id::crcd.name__4 +#: sqlsource.sql:63 +msgid "3_days_1_renew" +msgstr "3_jours_1_renouvellement" + +# id::cit.name__3 +#: sqlsource.sql:53 +msgid "Other" +msgstr "Autre" + +# id::i18n_l.name__fr-CA +#: sqlsource.sql:95 +msgid "French (Canada)" +msgstr "Français (Canada)" + +# id::cbs.source__1 +#: sqlsource.sql:3 msgid "oclc" -msgstr "OCLC" +msgstr "oclc" -#: config.bib_source:4 -msgid "System Local" -msgstr "Lorem ipsum" +# id::ccpbt.label__staff_client id::cbrebt.label__staff_client +#: sqlsource.sql:102 sqlsource.sql:105 +msgid "General Staff Client container" +msgstr "Lorem Ipsum" + +# id::cblvl.value__d +#: sqlsource.sql:82 +msgid "Subunit" +msgstr "Sous-unité" + +# id::cblvl.value__b +#: sqlsource.sql:80 +msgid "Serial component part" +msgstr "Élément de collections" + +# id::crcd.name__2 +#: sqlsource.sql:59 +msgid "28_days_2_renew" +msgstr "" + +# id::crcd.name__6 +#: sqlsource.sql:67 +msgid "35_days_1_renew" +msgstr "" -#: config.bib_source:5 +# id::cbs.source__3 +#: sqlsource.sql:7 msgid "Project Gutenberg" -msgstr "Projekt Runeberg" +msgstr "Project Gutenberg" -#: config.standing:7 -msgid "Good" -msgstr "Gut" +# id::crcd.name__1 +#: sqlsource.sql:57 +msgid "7_days_0_renew" +msgstr "" -#: config.standing:8 -msgid "Barred" -msgstr "största" +# id::i18n_l.name__en-US +#: sqlsource.sql:89 +msgid "English (US)" +msgstr "Anglais (États-Unis)" -#: config.audience_map:31 -msgid "Unknown or unspecified" +# id::ccpbt.label__misc id::ccnbt.label__misc id::cbrebt.label__misc +#: sqlsource.sql:101 sqlsource.sql:103 sqlsource.sql:104 +msgid "Miscellaneous" msgstr "" -#: config.audience_map:32 -msgid "Preschool" -msgstr "årligen" +# id::cblvl.value__c +#: sqlsource.sql:81 +msgid "Collection" +msgstr "Collection" + +# id::cblvl.value__i +#: sqlsource.sql:83 +msgid "Integrating resource" +msgstr "Ressource intégrée" -#: config.audience_map:33 -msgid "Primary" -msgstr "bläddra" +# id::vqbrad.description__4 +#: sqlsource.sql:78 +msgid "Pagination" +msgstr "Pagination" -#: config.audience_map:34 -msgid "Pre-adolescent" -msgstr "hjälp" +# id::cnct.name__1 +#: sqlsource.sql:45 +msgid "Paperback Book" +msgstr "Livre de poche" -#: config.audience_map:35 -msgid "Adolescent" -msgstr "utgåvor" +# id::i18n_l.description__es-US +#: sqlsource.sql:99 +msgid "American Spanish" +msgstr "Espagnol américain" -#: config.audience_map:36 -msgid "Adult" -msgstr "öppet" +# id::i18n_l.name__en-CA +#: sqlsource.sql:92 +msgid "English (Canada)" +msgstr "Anglais (Canada)" -#: config.audience_map:37 -msgid "Specialized" -msgstr "datorföreningen" +# id::i18n_l.name__es-US +#: sqlsource.sql:98 +msgid "Spanish (US)" +msgstr "Espagnol (États-Unis)" -#: config.audience_map:38 -msgid "General" -msgstr "skapa" +# id::i18n_l.description__en-CA +#: sqlsource.sql:93 +msgid "Canadian English" +msgstr "Anglais canadien" -#: config.audience_map:39 -msgid "Juvenile" -msgstr "klassisk" +# id::crcd.name__3 +#: sqlsource.sql:61 +msgid "3_months_0_renew" +msgstr "" -#: asset.copy_location:48 +# id::cst.value__2 +#: sqlsource.sql:10 +msgid "Barred" +msgstr "Barré" + +# id::cst.value__1 +#: sqlsource.sql:9 +msgid "Good" +msgstr "Bien" + +# id::vqbrad.description__3 +#: sqlsource.sql:77 +msgid "Language of work" +msgstr "Langue de l'oeuvre" + +# id::acpl.name__1 +#: sqlsource.sql:72 msgid "Stacks" -msgstr "Linköping" +msgstr "Piles" + +# id::i18n_l.description__en-US +#: sqlsource.sql:90 +msgid "American English" +msgstr "Anglais américain" + +# id::crcd.name__7 +#: sqlsource.sql:69 +msgid "7_days_2_renew" +msgstr "" + +# id::cblvl.value__m +#: sqlsource.sql:84 +msgid "Monograph/Item" +msgstr "Monographie ou article" + +# id::cit.name__1 +#: sqlsource.sql:49 +msgid "Drivers License" +msgstr "Permis de conduire" + +# id::vqbrad.description__1 +#: sqlsource.sql:76 +msgid "Author of work" +msgstr "Auteur de l'oeuvre" + +# id::i18n_l.description__fr-CA +#: sqlsource.sql:96 +msgid "Canadian French" +msgstr "Français canadien" + +# id::vqbrad.description__1 +#: sqlsource.sql:75 +msgid "Title of work" +msgstr "Titre de l'oeuvre" + +# id::cit.name__2 +#: sqlsource.sql:51 +msgid "SSN" +msgstr "" + +# id::cblvl.value__s +#: sqlsource.sql:85 +msgid "Serial" +msgstr "Collections" + +# id::crcd.name__5 +#: sqlsource.sql:65 +msgid "2_months_2_renew" +msgstr "" diff --git a/build/i18n/tests/data/sqlsource.sql b/build/i18n/tests/data/sqlsource.sql index 83280cff9a..dda3df85c6 100644 --- a/build/i18n/tests/data/sqlsource.sql +++ b/build/i18n/tests/data/sqlsource.sql @@ -1,49 +1,105 @@ --002.schema.config.sql: -INSERT INTO config.bib_source (quality, source, transcendant) VALUES - (90, oils_i18n_gettext('oclc'), FALSE), - (10, oils_i18n_gettext('System Local'), FALSE), - (1, oils_i18n_gettext('Project Gutenberg'), TRUE); - -INSERT INTO config.standing (value) VALUES (oils_i18n_gettext('Good')); -INSERT INTO config.standing (value) VALUES (oils_i18n_gettext('Barred')); - -INSERT INTO config.xml_transform VALUES ( 'marcxml', 'http://www.loc.gov/MARC21/slim', 'marc', '---' ); -INSERT INTO config.xml_transform VALUES ( 'mods', 'http://www.loc.gov/mods/', 'mods', '/home/miker/MARC21slim2MODS.xsl' ); - -INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'series', 'seriestitle', $$//mods:mods/mods:relatedItem[@type="series"]/mods:titleInfo$$ ), - ( 'title', 'abbreviated', $$//mods:mods/mods:titleInfo[mods:title and (@type='abbreviated')]$$ ), - ( 'title', 'translated', $$//mods:mods/mods:titleInfo[mods:title and (@type='translated')]$$ ), - ( 'title', 'uniform', $$//mods:mods/mods:titleInfo[mods:title and (@type='uniform')]$$ ), - ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods:title and not (@type)]$$ ), - ( 'author', 'corporate', $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ ), - ( 'author', 'personal', $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ ), - ( 'author', 'conference', $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ ), - ( 'author', 'other', $$//mods:mods/mods:name[@type='personal']/mods:namePart[not(../mods:role)]$$ ), - ( 'subject', 'geographic', $$//mods:mods/mods:subject/mods:geographic$$ ), - ( 'subject', 'name', $$//mods:mods/mods:subject/mods:name$$ ), - ( 'subject', 'temporal', $$//mods:mods/mods:subject/mods:temporal$$ ), - ( 'subject', 'topic', $$//mods:mods/mods:subject/mods:topic$$ ), --- ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods:mods/mods:genre$$ ), - ( 'keyword', 'keyword', $$//mods:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */ - -INSERT INTO config.audience_map (code, value, description) VALUES - ('', oils_i18n_gettext('Unknown or unspecified'), oils_i18n_gettext('The target audience for the item not known or not specified.')), - ('a', oils_i18n_gettext('Preschool'), oils_i18n_gettext('The item is intended for children, approximate ages 0-5 years.')), - ('b', oils_i18n_gettext('Primary'), oils_i18n_gettext('The item is intended for children, approximate ages 6-8 years.')), - ('c', oils_i18n_gettext('Pre-adolescent'), oils_i18n_gettext('The item is intended for young people, approximate ages 9-13 years.')), - ('d', oils_i18n_gettext('Adolescent'), oils_i18n_gettext('The item is intended for young people, approximate ages 14-17 years.')), - ('e', oils_i18n_gettext('Adult'), oils_i18n_gettext('The item is intended for adults.')), - ('f', oils_i18n_gettext('Specialized'), oils_i18n_gettext('The item is aimed at a particular audience and the nature of the presentation makes the item of little interest to another audience.')), - ('g', oils_i18n_gettext('General'), oils_i18n_gettext('The item is of general interest and not aimed at an audience of a particular intellectual level.')), - ('j', oils_i18n_gettext('Juvenile'), oils_i18n_gettext('The item is intended for children and young people, approximate ages 0-15 years.')); - --- Admin user -INSERT INTO permission.usr_perm_map (usr,perm,depth) VALUES (1,-1,0); - ---010.schema.biblio.sql: -INSERT INTO biblio.record_entry VALUES (-1,1,1,1,-1,NOW(),NOW(),FALSE,FALSE,'','AUTOGEN','-1','','FOO'); +INSERT INTO config.bib_source (id, quality, source, transcendant) VALUES + (1, 90, oils_i18n_gettext(1, 'oclc', 'cbs', 'source'), FALSE); +INSERT INTO config.bib_source (id, quality, source, transcendant) VALUES + (2, 10, oils_i18n_gettext(2, 'System Local', 'cbs', 'source'), FALSE); +INSERT INTO config.bib_source (id, quality, source, transcendant) VALUES + (3, 1, oils_i18n_gettext(3, 'Project Gutenberg', 'cbs', 'source'), TRUE); + +INSERT INTO config.standing (id, value) VALUES (1, oils_i18n_gettext(1, 'Good', 'cst', 'value')); +INSERT INTO config.standing (id, value) VALUES (2, oils_i18n_gettext(2, 'Barred', 'cst', 'value')); + +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'series', 'seriestitle', 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'title', 'abbreviated', 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='abbreviated')]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'title', 'translated', 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated')]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'title', 'alternative', 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative')]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'title', 'uniform', 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'title', 'proper', 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and not (@type)]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'author', 'corporate', 'mods32', $$//mods32:mods/mods32:name[@type='corporate']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'author', 'personal', 'mods32', $$//mods32:mods/mods32:name[@type='personal']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'author', 'conference', 'mods32', $$//mods32:mods/mods32:name[@type='conference']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'author', 'other', 'mods32', $$//mods32:mods/mods32:name[@type='personal']/mods32:namePart[not(../mods32:role)]$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'subject', 'geographic', 'mods32', $$//mods32:mods/mods32:subject/mods32:geographic$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'subject', 'name', 'mods32', $$//mods32:mods/mods32:subject/mods32:name$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'subject', 'temporal', 'mods32', $$//mods32:mods/mods32:subject/mods32:temporal$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'subject', 'topic', 'mods32', $$//mods32:mods/mods32:subject/mods32:topic$$ ); +--INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES +-- ( field_class, name, xpath ) VALUES ( 'subject', 'genre', 'mods32', $$//mods32:mods/mods32:genre$$ ); +INSERT INTO config.metabib_field ( field_class, name, format, xpath ) VALUES + ( 'keyword', 'keyword', 'mods32', $$//mods32:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */; + +INSERT INTO config.non_cataloged_type ( id, owning_lib, name ) VALUES ( 1, 1, oils_i18n_gettext(1, 'Paperback Book', 'cnct', 'name') ); +SELECT SETVAL('config.non_cataloged_type_id_seq'::TEXT, 100); + +INSERT INTO config.identification_type ( id, name ) VALUES + ( 1, oils_i18n_gettext(1, 'Drivers License', 'cit', 'name') ); +INSERT INTO config.identification_type ( id, name ) VALUES + ( 2, oils_i18n_gettext(2, 'SSN', 'cit', 'name') ); +INSERT INTO config.identification_type ( id, name ) VALUES + ( 3, oils_i18n_gettext(3, 'Other', 'cit', 'name') ); +SELECT SETVAL('config.identification_type_id_seq'::TEXT, 100); + +INSERT INTO config.rule_circ_duration VALUES + (1, oils_i18n_gettext(1, '7_days_0_renew', 'crcd', 'name'), '7 days', '7 days', '7 days', 0); +INSERT INTO config.rule_circ_duration VALUES + (2, oils_i18n_gettext(2, '28_days_2_renew', 'crcd', 'name'), '28 days', '28 days', '28 days', 2); +INSERT INTO config.rule_circ_duration VALUES + (3, oils_i18n_gettext(3, '3_months_0_renew', 'crcd', 'name'), '3 months', '3 months', '3 months', 0); +INSERT INTO config.rule_circ_duration VALUES + (4, oils_i18n_gettext(4, '3_days_1_renew', 'crcd', 'name'), '3 days', '3 days', '3 days', 1); +INSERT INTO config.rule_circ_duration VALUES + (5, oils_i18n_gettext(5, '2_months_2_renew', 'crcd', 'name'), '2 months', '2 months', '2 months', 2); +INSERT INTO config.rule_circ_duration VALUES + (6, oils_i18n_gettext(6, '35_days_1_renew', 'crcd', 'name'), '35 days', '35 days', '35 days', 1); +INSERT INTO config.rule_circ_duration VALUES + (7, oils_i18n_gettext(7, '7_days_2_renew', 'crcd', 'name'), '7 days', '7 days', '7 days', 2); --040.schema.asset.sql: -INSERT INTO asset.copy_location (name,owning_lib) VALUES (oils_i18n_gettext('Stacks'),1); -INSERT INTO asset.call_number VALUES (-1,1,NOW(),1,NOW(),-1,1,'UNCATALOGED'); +INSERT INTO asset.copy_location (id, name,owning_lib) VALUES (1, oils_i18n_gettext(1, 'Stacks', 'acpl', 'name'),1); + +-- Vandelay (for importing and exporting records) 012.schema.vandelay.sql +INSERT INTO vandelay.bib_attr_definition ( id, code, description, xpath ) VALUES (1, 'title', oils_i18n_gettext(1, 'Title of work', 'vqbrad', 'description'),'//*[@tag="245"]/*[contains("abcmnopr",@code)]'); +INSERT INTO vandelay.bib_attr_definition ( id, code, description, xpath ) VALUES (2, 'author', oils_i18n_gettext(1, 'Author of work', 'vqbrad', 'description'),'//*[@tag="100" or @tag="110" or @tag="113"]/*[contains("ad",@code)]'); +INSERT INTO vandelay.bib_attr_definition ( id, code, description, xpath ) VALUES (3, 'language', oils_i18n_gettext(3, 'Language of work', 'vqbrad', 'description'),'//*[@tag="240"]/*[@code="l"][1]'); +INSERT INTO vandelay.bib_attr_definition ( id, code, description, xpath ) VALUES (4, 'pagination', oils_i18n_gettext(4, 'Pagination', 'vqbrad', 'description'),'//*[@tag="300"]/*[@code="a"][1]'); + +INSERT INTO config.bib_level_map (code, value) VALUES ('b', oils_i18n_gettext('b', 'Serial component part', 'cblvl', 'value')); +INSERT INTO config.bib_level_map (code, value) VALUES ('c', oils_i18n_gettext('c', 'Collection', 'cblvl', 'value')); +INSERT INTO config.bib_level_map (code, value) VALUES ('d', oils_i18n_gettext('d', 'Subunit', 'cblvl', 'value')); +INSERT INTO config.bib_level_map (code, value) VALUES ('i', oils_i18n_gettext('i', 'Integrating resource', 'cblvl', 'value')); +INSERT INTO config.bib_level_map (code, value) VALUES ('m', oils_i18n_gettext('m', 'Monograph/Item', 'cblvl', 'value')); +INSERT INTO config.bib_level_map (code, value) VALUES ('s', oils_i18n_gettext('s', 'Serial', 'cblvl', 'value')); + +-- available locales +INSERT INTO config.i18n_locale (code,marc_code,name,description) + VALUES ('en-US', 'eng', oils_i18n_gettext('en-US', 'English (US)', 'i18n_l', 'name'), + oils_i18n_gettext('en-US', 'American English', 'i18n_l', 'description')); +INSERT INTO config.i18n_locale (code,marc_code,name,description) + VALUES ('en-CA', 'eng', oils_i18n_gettext('en-CA', 'English (Canada)', 'i18n_l', 'name'), + oils_i18n_gettext('en-CA', 'Canadian English', 'i18n_l', 'description')); +INSERT INTO config.i18n_locale (code,marc_code,name,description) + VALUES ('fr-CA', 'fre', oils_i18n_gettext('fr-CA', 'French (Canada)', 'i18n_l', 'name'), + oils_i18n_gettext('fr-CA', 'Canadian French', 'i18n_l', 'description')); +INSERT INTO config.i18n_locale (code,marc_code,name,description) + VALUES ('es-US', 'spa', oils_i18n_gettext('es-US', 'Spanish (US)', 'i18n_l', 'name'), + oils_i18n_gettext('es-US', 'American Spanish', 'i18n_l', 'description')); + +INSERT INTO container.copy_bucket_type (code,label) VALUES ('misc', oils_i18n_gettext('misc', 'Miscellaneous', 'ccpbt', 'label')); +INSERT INTO container.copy_bucket_type (code,label) VALUES ('staff_client', oils_i18n_gettext('staff_client', 'General Staff Client container', 'ccpbt', 'label')); +INSERT INTO container.call_number_bucket_type (code,label) VALUES ('misc', oils_i18n_gettext('misc', 'Miscellaneous', 'ccnbt', 'label')); +INSERT INTO container.biblio_record_entry_bucket_type (code,label) VALUES ('misc', oils_i18n_gettext('misc', 'Miscellaneous', 'cbrebt', 'label')); +INSERT INTO container.biblio_record_entry_bucket_type (code,label) VALUES ('staff_client', oils_i18n_gettext('staff_client', 'General Staff Client container', 'cbrebt', 'label')); -- 2.43.2