• Publicity: Public Only All

lang-catalog-procs.tcl

Routines for importing/exporting messages from/to XML message catalog files. Every OpenACS package has one message catalog file for each locale (language and region) that its UI supports. Importing of messages means reading the messages from XML catalog files and storing them in the database. Exporting of messages refers to the opposite process. The key procedures in this library are:

  • lang::catalog::import - Import all catalog files on the system into the database. Can be restricted to only import from one package and only certain locales.
  • lang::catalog::import_from_file - Import from a single catalog file
  • lang::catalog::export - Export all messages in the database to catalog files. Can be restricted to only export from one package and only certain locales.
  • lang::catalog::export_to_file - Export messages to a single file

Location:
packages/acs-lang/tcl/lang-catalog-procs.tcl
Created:
10 September 2000
Authors:
Jeff Davis
Peter Marklund <peter@collaboraid.biz>
Lars Pind <lars@collaboraid.biz>
CVS Identification:
$Id: lang-catalog-procs.tcl,v 1.60.2.8 2022/08/29 14:17:23 antoniop Exp $

Procedures in this file

Detailed information

lang::catalog::export (public)

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

Exports I18N messages from the database to XML catalog files. By default exports messages for all enabled packages and all enabled locales on the system. Can be restricted to export only for a certain package and/or a list of locales.

Switches:
-package_key
(optional)
A key of a package to restrict the export to
-locales
(optional)
A list of locales to restrict the export to
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_catalog_import_export test_catalog_import_export (test acs-lang) lang::catalog::export lang::catalog::export test_test_catalog_import_export->lang::catalog::export apm_enabled_packages apm_enabled_packages (public) lang::catalog::export->apm_enabled_packages db_dml db_dml (public) lang::catalog::export->db_dml db_foreach db_foreach (public) lang::catalog::export->db_foreach lang::catalog::all_messages_for_package_and_locale lang::catalog::all_messages_for_package_and_locale (private) lang::catalog::export->lang::catalog::all_messages_for_package_and_locale lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::export->lang::catalog::export_to_file lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::catalog::export packages/acs-admin/www/apm/version-i18n-export.tcl packages/acs-admin/ www/apm/version-i18n-export.tcl packages/acs-admin/www/apm/version-i18n-export.tcl->lang::catalog::export packages/acs-lang/www/admin/export-locale-to-files.tcl packages/acs-lang/ www/admin/export-locale-to-files.tcl packages/acs-lang/www/admin/export-locale-to-files.tcl->lang::catalog::export packages/acs-lang/www/admin/export-messages.tcl packages/acs-lang/ www/admin/export-messages.tcl packages/acs-lang/www/admin/export-messages.tcl->lang::catalog::export

Testcases:
test_catalog_import_export

lang::catalog::import (public)

 lang::catalog::import [ -package_key package_key ] \
    [ -locales locales ] [ -initialize ] [ -cache ]

Import messages from catalog files to the database. By default all messages for enabled packages and enabled locales will be imported. Optionally, the import can be restricted to a certain package and/or a list of locales. Invokes the proc lang::catalog::import_messages that deals with multiple imports (upgrades).

Switches:
-package_key
(optional)
Restrict the import to the package with this key
-locales
(optional)
A list of locales to restrict the import to
-initialize
(boolean) (optional)
Only load messages from packages that have never before had any message imported
-cache
(boolean) (optional)
Provide this switch if you want the proc to cache all the imported messages
Returns:
An array list containing the number of messages processed, number of messages added, number of messages updated, number of messages deleted by the import, and a list of errors produced. The keys of the array list are processed, added, updated, and deleted, and errors.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_lang_test__lc_procs lang_test__lc_procs (test acs-lang) lang::catalog::import lang::catalog::import test_lang_test__lc_procs->lang::catalog::import test_locale_language_fallback locale_language_fallback (test acs-lang) test_locale_language_fallback->lang::catalog::import test_test_catalog_import_export test_catalog_import_export (test acs-lang) test_test_catalog_import_export->lang::catalog::import test_upgrade upgrade (test acs-lang) test_upgrade->lang::catalog::import ad_log ad_log (public) lang::catalog::import->ad_log ad_try ad_try (public) lang::catalog::import->ad_try apm_enabled_packages apm_enabled_packages (public) lang::catalog::import->apm_enabled_packages lang::catalog::get_catalog_paths_for_import lang::catalog::get_catalog_paths_for_import (private) lang::catalog::import->lang::catalog::get_catalog_paths_for_import lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import->lang::catalog::import_from_file apm_load_catalog_files apm_load_catalog_files (private) apm_load_catalog_files->lang::catalog::import lang::test::execute_upgrade lang::test::execute_upgrade (private) lang::test::execute_upgrade->lang::catalog::import packages/acs-admin/www/apm/version-i18n-import.tcl packages/acs-admin/ www/apm/version-i18n-import.tcl packages/acs-admin/www/apm/version-i18n-import.tcl->lang::catalog::import packages/acs-lang/www/admin/import-locale-from-files.tcl packages/acs-lang/ www/admin/import-locale-from-files.tcl packages/acs-lang/www/admin/import-locale-from-files.tcl->lang::catalog::import packages/acs-lang/www/admin/import-messages.tcl packages/acs-lang/ www/admin/import-messages.tcl packages/acs-lang/www/admin/import-messages.tcl->lang::catalog::import

Testcases:
lang_test__lc_procs, locale_language_fallback, upgrade, test_catalog_import_export

lang::catalog::package_catalog_dir (public)

 lang::catalog::package_catalog_dir package_key

Return the catalog directory of the given package.

Parameters:
package_key
Author:
Peter Marklund <peter@collaboraid.biz>
Created:
18 October 2002

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__replace_temporary_tags_with_lookups util__replace_temporary_tags_with_lookups (test acs-lang) lang::catalog::package_catalog_dir lang::catalog::package_catalog_dir test_util__replace_temporary_tags_with_lookups->lang::catalog::package_catalog_dir acs_package_root_dir acs_package_root_dir (public) lang::catalog::package_catalog_dir->acs_package_root_dir lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::export_to_file->lang::catalog::package_catalog_dir lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path (private) lang::catalog::get_catalog_file_path->lang::catalog::package_catalog_dir lang::catalog::get_catalog_files lang::catalog::get_catalog_files (private) lang::catalog::get_catalog_files->lang::catalog::package_catalog_dir lang::catalog::import lang::catalog::import (public) lang::catalog::import->lang::catalog::package_catalog_dir lang::catalog::package_has_files_in_locale_p lang::catalog::package_has_files_in_locale_p (private) lang::catalog::package_has_files_in_locale_p->lang::catalog::package_catalog_dir

Testcases:
util__replace_temporary_tags_with_lookups

lang::catalog::package_delete (public)

 lang::catalog::package_delete -package_key package_key

Unregister the I18N messages for the package.

Switches:
-package_key
(required)
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_catalog_import_export test_catalog_import_export (test acs-lang) lang::catalog::package_delete lang::catalog::package_delete test_test_catalog_import_export->lang::catalog::package_delete db_dml db_dml (public) lang::catalog::package_delete->db_dml db_list db_list (public) lang::catalog::package_delete->db_list lang::message::remove_from_cache lang::message::remove_from_cache (private) lang::catalog::package_delete->lang::message::remove_from_cache apm_package_delete apm_package_delete (public) apm_package_delete->lang::catalog::package_delete

Testcases:
test_catalog_import_export
[ show source ]