lang::catalog::get_catalog_paths_for_import (private)

 lang::catalog::get_catalog_paths_for_import -package_key package_key \
    [ -locales locales ]

Defined in packages/acs-lang/tcl/lang-catalog-procs.tcl

Return a list of file paths for the catalog files of the given package. Can be restricted to only return files for certain locales. The list will be sorted in an order appropriate for import to the database.

Switches:
-package_key (required)
The key of the package to get catalog file paths for
-locales (optional)
A list of locales to restrict the catalog files to
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_catalog_files_are_tdom_parsable_xml catalog_files_are_tdom_parsable_xml (test acs-lang) lang::catalog::get_catalog_paths_for_import lang::catalog::get_catalog_paths_for_import test_catalog_files_are_tdom_parsable_xml->lang::catalog::get_catalog_paths_for_import db_list db_list (public) lang::catalog::get_catalog_paths_for_import->db_list lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path (private) lang::catalog::get_catalog_paths_for_import->lang::catalog::get_catalog_file_path lang::catalog::package_has_files_in_locale_p lang::catalog::package_has_files_in_locale_p (private) lang::catalog::get_catalog_paths_for_import->lang::catalog::package_has_files_in_locale_p lang::catalog::import lang::catalog::import (public) lang::catalog::import->lang::catalog::get_catalog_paths_for_import

Testcases:
catalog_files_are_tdom_parsable_xml
Source code:
    # We always need to register en_US messages first as they create the keys
    set en_us_locale_list [list en_US]
    set other_locales_list [db_list locales {
        select locale
        from ad_locales
        where enabled_p = 't'
        and locale <> 'en_US'
    }]
    set locales_list [concat $en_us_locale_list $other_locales_list]

    # Get all catalog files for enabled locales
    set catalog_files [list]
    foreach locale $locales_list {

        # If we are only processing certain locales and this is not one of them - continue
        if { [llength $locales] > 0 && $locale ni $locales } {
            continue
        }

        # If the package has no files in this locale - continue
        if { ![package_has_files_in_locale_p $package_key $locale] } {
            continue
        }

        set file_path [get_catalog_file_path  -package_key $package_key  -locale $locale]

        if { [file exists $file_path] } {
            lappend catalog_files $file_path
        } else {
            ns_log Error "Catalog file $file_path not found. Failed to import messages for package $package_key and locale $locale"
        }
    }

    return $catalog_files
Generic XQL file:
packages/acs-lang/tcl/lang-catalog-procs.xql

PostgreSQL XQL file:
packages/acs-lang/tcl/lang-catalog-procs-postgresql.xql

Oracle XQL file:
packages/acs-lang/tcl/lang-catalog-procs-oracle.xql

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