ref_language::apm::add_language_639_2_codes (private)

 ref_language::apm::add_language_639_2_codes

Defined in packages/ref-language/tcl/apm-callback-procs.tcl

Fills language_639_2_codes The ISO-639-2 codes are in a dat file located at ref-language/sql/commjon directory. The file was downloaded from http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt Separator is "|" and the columns are:

  • ISO 639-2 Bibliographic code (used if terminology one is empty)
  • ISO 639-2 Terminology code (used if exists)
  • ISO 639-1 code (2 digits)
  • Language name in english
  • Language name in french (ignored if present)

Partial Call Graph (max 5 caller/called nodes):
%3 ref_language::apm::after_install ref_language::apm::after_install (private) ref_language::apm::add_language_639_2_codes ref_language::apm::add_language_639_2_codes ref_language::apm::after_install->ref_language::apm::add_language_639_2_codes ref_language::apm::after_upgrade ref_language::apm::after_upgrade (private) ref_language::apm::after_upgrade->ref_language::apm::add_language_639_2_codes acs_root_dir acs_root_dir (public) ref_language::apm::add_language_639_2_codes->acs_root_dir ref_language::set_data ref_language::set_data (public) ref_language::apm::add_language_639_2_codes->ref_language::set_data

Testcases:
No testcase defined.
Source code:

    set filename "[acs_root_dir]/packages/ref-language/sql/common/iso-639-2.dat"

    set channel [open $filename]
    set data [read $channel]
    close $channel

    set row_list [split $data "\n"]
    foreach row $row_list {

        if { $row eq "" } {
            continue
        }

        set col_list [split $row "|"]

        # Set iso-639-2 code to terminology if exists, otherwise
        # uses the bibliography one (see RFC 4646)

        set iso2b [lindex $col_list 0]
        set iso2 [lindex $col_list 1]
        set iso1 [lindex $col_list 2]
        set label [lindex $col_list 3]

        if { $iso2 eq "" } {
            set iso2 $iso2b
        }

        ref_language::set_data -iso2 $iso2 -iso1 $iso1 -label $label

    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/ref-language/tcl/apm-callback-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: