Change Language for USMARC code

  • any body know how to change US MARC fields

    • 1) Check Library of Congress MARC standards website, section MARC Translations.
      - Use an official translation if it exists.
      - If not, be prepared to discover something called library science.

      2) The files containing MARC field descriptions
      are only used during install, from then OpenBiblio pulls the descriptions from the created database tables.
      Brief instruction where to look for these files:
      If you copied 
      to /locale/<2 letter country code>/
      to produce your translation, then you can find the files in
      /locale/<2 letter country code>/sql/0.5.2/domain/

      3) Edit the files found in step 2)
      - Follow the rules for SQL insert statements, for example certain characters have to be \'Escaped\'
      - Perhaps MySQL needs to be prepared in some way for some languages.
      (If you need more accurate instructions on this please consult the MySQL documentation)

      See also

    • BRC

      An easy way to have it is dumping the database with mysqldump ( Vgr: #mysqldump -uUser -pPasswd -hServer openbiblio >dumped.sql )

      Then you have to edit dumped.sql and remplace the usmarc code from english to your language. Just say you open it in OpenOffice an use the search and replace tool.
      when you´re done, just load the translated file like this:
      #mysql -p openbiblio <dumped.sql
      Or you can edit the content of the tables usmarc_subfield_dm and usmarc_tag_dm, where is stored the usmarc tags.

      I wrote a guide of how I get it done in spanish.

    • scud

      Yeah, that was my first impression but although I translated the fields (in greek) and uploaded them to my mySQL without any problem, in the biblio page all greek text shows up as questionmarks (????)
      I remember that I had encountered a similar problem with another script and the mysql_query('SET NAMES "utf8"'); did the trick. I am not too sure where to use this in this script though.

      Anyway, I am really thrilled about this script, in general, but not too thrilled about its lack of unicode support.

    • scud

      OK, I found a solution for the MARC fields.

      I DID dump the mySQL DB and convert it to utf-8. I translated all required fields. I uploaded them back to the DB.

      I did a multi-file search for all instances of mysql_query and inserted the mysql_query('SET NAMES "utf8"'); right above each one of the instances. Worked like a charm.

      • Micah Stetson
        Micah Stetson

        There should be exactly one instance of mysql_query, at least in 0.6.0.  It's in classes/Query.php:89.  But since SET NAMES is per-connection, I think you should instead put it after the calls to mysql_connect() and mysql_select_db() around line 47 of Query.php.  That way it doesn't get run for every single query.

        However, SET NAMES just tells MySQL the character set for queries you're sending it in the current connection -- it doesn't say which character set should be used for storage or for sending back results.  I think you also want to set the database character set to utf-8.  You could do that on a new OpenBiblio install by creating the database like this:


        To get this going on an install that's already done, you could either dump and reload the database or perhaps use ALTER TABLE statements to change each table's character set.


        • scud

          I had already changed the DB default character set and all seems to be working OK.

    • Yesss, that's awsome!  I knew I had to SET NAMES, but not WHERE?!?!?  I've been combing the net for weeks.  Thank you, Micah Stetson!

  • Super Thin
    Super Thin

    When we change all of strings from English to another language => We switch to English (from Admin -> Library Settings) => US MARC fields legends will be effected/ changed. Can I use another way to exist 2 or more languages (for US MARC fields) parallely?

    • No, not that I am aware of. Unlike the translation in php files under locale/xx, the descriptions for US MARC fields are taken from the database. Therefore the descriptions do not change when the language is switched.


  • Anonymous

    Post awaiting moderation.


Cancel   Add attachments