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::all_messages_for_package_and_locale (private)

 lang::catalog::all_messages_for_package_and_locale package_key locale

Set a multirow with name all_messages locally in the callers scope with the columns message_key and message for all message keys that do not have an upgrade status of deleted.

Parameters:
package_key
locale
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::export lang::catalog::export (public) lang::catalog::all_messages_for_package_and_locale lang::catalog::all_messages_for_package_and_locale lang::catalog::export->lang::catalog::all_messages_for_package_and_locale lang::catalog::messages_in_db lang::catalog::messages_in_db (private) lang::catalog::messages_in_db->lang::catalog::all_messages_for_package_and_locale db_list_of_lists db_list_of_lists (public) lang::catalog::all_messages_for_package_and_locale->db_list_of_lists

Testcases:
No testcase defined.

lang::catalog::assert_catalog_file (private)

 lang::catalog::assert_catalog_file catalog_file_path

Throws an error if the given path is not valid for a catalog file.

Parameters:
catalog_file_path
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::assert_catalog_file lang::catalog::assert_catalog_file lang::catalog::import_from_file->lang::catalog::assert_catalog_file apm_is_catalog_file apm_is_catalog_file (public) lang::catalog::assert_catalog_file->apm_is_catalog_file

Testcases:
No testcase defined.

lang::catalog::default_charset_if_unsupported (private)

 lang::catalog::default_charset_if_unsupported charset

Will return the system default charset and issue a warning in the log file if the given charset is not supported by tcl. Otherwise the given charset is simply returned.

Parameters:
charset
Authors:
Jeff Davis
Peter Marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::default_charset_if_unsupported lang::catalog::default_charset_if_unsupported lang::catalog::export_to_file->lang::catalog::default_charset_if_unsupported lang::catalog::read_file lang::catalog::read_file (private) lang::catalog::read_file->lang::catalog::default_charset_if_unsupported

Testcases:
No testcase defined.

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::export_to_file (private)

 lang::catalog::export_to_file [ -descriptions_list descriptions_list ] \
    file_path messages_list

Export messages for a certain locale and package from the database to a given XML catalog file. If the catalog file already exists it will be backed up to a file with the same name but the extension .orig added to it. If there is an old backup file no new backup is done.

Switches:
-descriptions_list
(optional)
Parameters:
file_path - The path of the catalog file to write messages to. The filename needs to be parseable by apm_parse_catalog_path. The file and the catalog directory will be created if they don't exist.
messages_list - A list with message keys on even indices followed by corresponding messages on odd indices.
Author:
Peter Marklund <peter@collaboraid.biz>

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::export_to_file lang::catalog::export_to_file test_util__replace_temporary_tags_with_lookups->lang::catalog::export_to_file apm_parse_catalog_path apm_parse_catalog_path (public) lang::catalog::export_to_file->apm_parse_catalog_path lang::catalog::default_charset_if_unsupported lang::catalog::default_charset_if_unsupported (private) lang::catalog::export_to_file->lang::catalog::default_charset_if_unsupported lang::catalog::get_catalog_files lang::catalog::get_catalog_files (private) lang::catalog::export_to_file->lang::catalog::get_catalog_files lang::catalog::package_catalog_dir lang::catalog::package_catalog_dir (public) lang::catalog::export_to_file->lang::catalog::package_catalog_dir lang::catalog::export lang::catalog::export (public) lang::catalog::export->lang::catalog::export_to_file lang::test::execute_upgrade lang::test::execute_upgrade (private) lang::test::execute_upgrade->lang::catalog::export_to_file

Testcases:
util__replace_temporary_tags_with_lookups

lang::catalog::get_catalog_file_path (private)

 lang::catalog::get_catalog_file_path \
    [ -backup_from_version backup_from_version ] \
    [ -backup_to_version backup_to_version ] -package_key package_key \
    -locale locale [ -charset charset ]

Get the full path of the catalog file for a given package, and locale.

Switches:
-backup_from_version
(optional)
-backup_to_version
(optional)
-package_key
(required)
-locale
(required)
-charset
(optional)
Should normally not be provided. Will force the charset to a certain value. If not provided an appropriate charset to write the locale in will be used.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::export lang::catalog::export (public) lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path lang::catalog::export->lang::catalog::get_catalog_file_path lang::catalog::get_catalog_paths_for_import lang::catalog::get_catalog_paths_for_import (private) lang::catalog::get_catalog_paths_for_import->lang::catalog::get_catalog_file_path lang::test::execute_upgrade lang::test::execute_upgrade (private) lang::test::execute_upgrade->lang::catalog::get_catalog_file_path lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::catalog::get_catalog_file_path lang::catalog::message_backup_file_prefix lang::catalog::message_backup_file_prefix (private) lang::catalog::get_catalog_file_path->lang::catalog::message_backup_file_prefix lang::catalog::package_catalog_dir lang::catalog::package_catalog_dir (public) lang::catalog::get_catalog_file_path->lang::catalog::package_catalog_dir lang::util::charset_for_locale lang::util::charset_for_locale (public) lang::catalog::get_catalog_file_path->lang::util::charset_for_locale

Testcases:
No testcase defined.

lang::catalog::get_catalog_files (private)

 lang::catalog::get_catalog_files package_key

Return the full paths of all message catalog files of the given package.

Parameters:
package_key - The key of the package to return catalog file paths for
Returns:
A list of catalog file paths
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::get_catalog_files lang::catalog::get_catalog_files lang::catalog::export_to_file->lang::catalog::get_catalog_files apm_is_catalog_file apm_is_catalog_file (public) lang::catalog::get_catalog_files->apm_is_catalog_file lang::catalog::package_catalog_dir lang::catalog::package_catalog_dir (public) lang::catalog::get_catalog_files->lang::catalog::package_catalog_dir

Testcases:
No testcase defined.

lang::catalog::get_catalog_paths_for_import (private)

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

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

lang::catalog::get_required_xml_attribute (private)

 lang::catalog::get_required_xml_attribute element attribute

Return the value of the given attribute and raise an error if the value is missing or empty.

Parameters:
element
attribute
Author:
Peter Marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::parse lang::catalog::parse (private) lang::catalog::get_required_xml_attribute lang::catalog::get_required_xml_attribute lang::catalog::parse->lang::catalog::get_required_xml_attribute xml_node_get_attribute xml_node_get_attribute (public) lang::catalog::get_required_xml_attribute->xml_node_get_attribute xml_node_get_name xml_node_get_name (public) lang::catalog::get_required_xml_attribute->xml_node_get_name

Testcases:
No testcase defined.

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::import_from_file (private)

 lang::catalog::import_from_file file_path

Import messages for a certain locale and package from a given XML catalog file to the database. This procedure invokes lang::catalog::parse to read the catalog file and lang::message::register to register the messages with the system (updates database and cache).

The import should be considered an upgrade if the package has had messages imported before. In this case the proc lang::catalog::import_messages will be used to register the new messages with the system and handle the upgrade logic (a merge with what's in the database).

Parameters:
file_path - The absolute path of the XML file to import messages from. The path must be on valid format, see apm_is_catalog_file
Returns:
An array list containing the number of messages processed, number of messages added, number of messages updated, and the number of messages deleted by the import. The keys of the array list are processed, added, updated, and deleted.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import lang::catalog::import (public) lang::catalog::import_from_file lang::catalog::import_from_file lang::catalog::import->lang::catalog::import_from_file ad_log ad_log (public) lang::catalog::import_from_file->ad_log ad_try ad_try (public) lang::catalog::import_from_file->ad_try apm_parse_catalog_path apm_parse_catalog_path (public) lang::catalog::import_from_file->apm_parse_catalog_path lang::catalog::assert_catalog_file lang::catalog::assert_catalog_file (private) lang::catalog::import_from_file->lang::catalog::assert_catalog_file lang::catalog::import_messages lang::catalog::import_messages (private) lang::catalog::import_from_file->lang::catalog::import_messages

Testcases:
No testcase defined.

lang::catalog::import_messages (private)

 lang::catalog::import_messages -file_messages_list file_messages_list \
    -package_key package_key -locale locale

Import a given set of messages from a catalog file to the database for a certain package and locale. If we already have messages in the db for the given package and locale then a merge between the database messages and the file messages will be performed.

Foreach message to import, the base messages for the merge is the messages in the db from the last time db and catalog file were in sync for the corresponding message key. The first such sync point is the initial import of a message. After that, any export of messages to the filesystem will be a sync point. Also, after an upgrade, a large number of the resulting messages in the db will be identical to those in the file (the file messages take precedence on conflict) and those messages will also be sync points. A message being in sync between db and file is indicated by the lang_message.sync_time column being set to a not null value.

This proc is idempotent which means that it can be executed multiple times and after the first time it's been executed it won't have any effect on the db. See the corresponding acs-automated-testing test case called upgrade.

What follows below is a description of the logic of the proc in terms of its input, the cases considered, and the logical actions taken for each case.

There are three sets of keys, file, db, and base keys. For each key in the union of these keys there are three messages that can exist: the file message, the db message, and the base message. The base message serves as the base for the merge. We will distinguish all the different permutations of each of the three messages existing or not, and all permutations of the messages being different from each other. We don't distinguish how two messages are different, only whether they are different or not. In total that gives us 14 cases (permutations) to consider.

    *** Exactly one of messages exists (3 cases):

    1. base message (deleted in file and db). upgrade_action=none, conflict_p=f

    2. db message (added in db). upgrade_action=none, conflict_p=f

    3. file message (added in file). upgrade_action=add, conflict_p=f

    *** Exactly two of the messages exist (6 cases):

    - Base and file message (db message deleted):
      4. Differ (conflicting change). upgrade_action=resurrect, conflict_p=t
      5. No difference (no conflicting change). upgrade_action=none, conflict_p=f

    - Base and db message (file message deleted):
      6. Differ (conflicting change): upgrade_action=delete, conflict_p=t
      7. No difference (no conflicting change): upgrade_action=delete, conflict_p=f

    - File and db message (message added in both db and file):
      8. Differ (conflicting change). upgrade_action=update, conflict_p=t
      9. No difference (identical changes). upgrade_action=none, conflict_p=f

    *** All three messages exist (5 cases):

    10. All the same. upgrade_action=none, conflict_p=f

    11. File and base the same. upgrade_action=none, conflict_p=f

    12. DB and base the same. upgrade_action=update, conflict_p=f

    13. File and DB the same. upgrade_action=none, conflict_p=f

    14. All different. upgrade_action=update, conflict_p=t
    

Switches:
-file_messages_list
(required)
An array list with message keys as keys and the message of those keys as values, i.e. (key, value, key, value, ...)
-package_key
(required)
The package_key for the messages.
-locale
(required)
The locale of the 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.
Authors:
Peter Marklund
Lars Pind

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import_messages lang::catalog::import_messages lang::catalog::import_from_file->lang::catalog::import_messages ad_try ad_try (public) lang::catalog::import_messages->ad_try lang::catalog::last_sync_messages lang::catalog::last_sync_messages (private) lang::catalog::import_messages->lang::catalog::last_sync_messages lang::catalog::messages_in_db lang::catalog::messages_in_db (private) lang::catalog::import_messages->lang::catalog::messages_in_db lang::message::edit lang::message::edit (private) lang::catalog::import_messages->lang::message::edit lang::message::register lang::message::register (public) lang::catalog::import_messages->lang::message::register

Testcases:
No testcase defined.

lang::catalog::is_upgrade_backup_file (private)

 lang::catalog::is_upgrade_backup_file file_path

Given a file path return 1 if the path represents a file with messages backed up from message catalog upgrade.

Parameters:
file_path
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 apm_parse_catalog_path apm_parse_catalog_path (public) lang::catalog::is_upgrade_backup_file lang::catalog::is_upgrade_backup_file lang::catalog::is_upgrade_backup_file->apm_parse_catalog_path

Testcases:
No testcase defined.

lang::catalog::last_sync_messages (private)

 lang::catalog::last_sync_messages -package_key package_key \
    -locale locale

For a certain package, and locale, return the messages in the database the last time catalog files and db were in sync. This is the message that we use as merge base during message catalog upgrades.

Switches:
-package_key
(required)
-locale
(required)
Returns:
An array list with message keys as keys and messages as values.
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import_messages lang::catalog::import_messages (private) lang::catalog::last_sync_messages lang::catalog::last_sync_messages lang::catalog::import_messages->lang::catalog::last_sync_messages db_foreach db_foreach (public) lang::catalog::last_sync_messages->db_foreach

Testcases:
No testcase defined.

lang::catalog::message_backup_file_prefix (private)

 lang::catalog::message_backup_file_prefix

The prefix used for files where we store old messages that were overwritten during message catalog upgrade.

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path (private) lang::catalog::message_backup_file_prefix lang::catalog::message_backup_file_prefix lang::catalog::get_catalog_file_path->lang::catalog::message_backup_file_prefix

Testcases:
No testcase defined.

lang::catalog::messages_in_db (private)

 lang::catalog::messages_in_db -package_key package_key -locale locale

Return a list of all messages for a certain package and locale.

Switches:
-package_key
(required)
-locale
(required)
Returns:
An array list with message keys as keys and messages as values.
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import_messages lang::catalog::import_messages (private) lang::catalog::messages_in_db lang::catalog::messages_in_db lang::catalog::import_messages->lang::catalog::messages_in_db lang::test::execute_upgrade lang::test::execute_upgrade (private) lang::test::execute_upgrade->lang::catalog::messages_in_db lang::catalog::all_messages_for_package_and_locale lang::catalog::all_messages_for_package_and_locale (private) lang::catalog::messages_in_db->lang::catalog::all_messages_for_package_and_locale

Testcases:
No testcase defined.

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

lang::catalog::package_has_files_in_locale_p (private)

 lang::catalog::package_has_files_in_locale_p package_key locale

Return 1 if the given package has any catalog files for the given locale and 0 otherwise.

Parameters:
package_key
locale
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_lang_package_has_files_in_locale_p lang_package_has_files_in_locale_p (test acs-lang) lang::catalog::package_has_files_in_locale_p lang::catalog::package_has_files_in_locale_p test_lang_package_has_files_in_locale_p->lang::catalog::package_has_files_in_locale_p lang::catalog::package_catalog_dir lang::catalog::package_catalog_dir (public) lang::catalog::package_has_files_in_locale_p->lang::catalog::package_catalog_dir lang::catalog::get_catalog_paths_for_import lang::catalog::get_catalog_paths_for_import (private) lang::catalog::get_catalog_paths_for_import->lang::catalog::package_has_files_in_locale_p

Testcases:
lang_package_has_files_in_locale_p

lang::catalog::parse (private)

 lang::catalog::parse catalog_file_contents

Parse the given catalog file xml contents and return the data as an array. The array will contain the following keys:

      package_key
      locale
      charset
      messages    - An array-list with message keys as keys and the message texts as values.
      descriptions - An array-list with message keys as keys and the descriptions as values.
    

Parameters:
catalog_file_contents
Authors:
Peter Marklund <peter@collaboraid.biz>
Simon Carstensen <simon@collaboraid.biz>

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::parse lang::catalog::parse test_util__replace_temporary_tags_with_lookups->lang::catalog::parse lang::catalog::get_required_xml_attribute lang::catalog::get_required_xml_attribute (private) lang::catalog::parse->lang::catalog::get_required_xml_attribute xml_doc_get_first_node xml_doc_get_first_node (public) lang::catalog::parse->xml_doc_get_first_node xml_node_get_children_by_name xml_node_get_children_by_name (public) lang::catalog::parse->xml_node_get_children_by_name xml_node_get_content xml_node_get_content (public) lang::catalog::parse->xml_node_get_content xml_node_get_name xml_node_get_name (public) lang::catalog::parse->xml_node_get_name lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import_from_file->lang::catalog::parse lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::catalog::parse

Testcases:
util__replace_temporary_tags_with_lookups

lang::catalog::read_file (private)

 lang::catalog::read_file catalog_filename

Returns the contents of the given catalog file as a string reading the file with the charset given in the filename.

Parameters:
catalog_filename - The full path of the catalog file to read. The basename of the file should be on the form package_key.locale.charset.ending where ending is either cat or xml (i.e. dotlrn.en_US.iso-8859-1.xml or dotlrn.en_US.iso-8859-1.cat). The cat ending is for the deprecated tcl-based catalog files.
Authors:
Jeff Davis
Peter Marklund <peter@collaboraid.biz>

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::read_file lang::catalog::read_file test_util__replace_temporary_tags_with_lookups->lang::catalog::read_file lang::catalog::default_charset_if_unsupported lang::catalog::default_charset_if_unsupported (private) lang::catalog::read_file->lang::catalog::default_charset_if_unsupported lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import_from_file->lang::catalog::read_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::read_file

Testcases:
util__replace_temporary_tags_with_lookups

lang::catalog::translate (private)

 lang::catalog::translate

Translates all untranslated strings in a message catalog from English into Spanish, French and German using Babelfish. NOTE: this proc is unmaintained. Quick way to get a multilingual site up and running if you can live with the quality of the translations.

Not a good idea to run this procedure if you have a large message catalog. Use for testing purposes only.

Author:
John Lowry <lowry@arsdigita.com>

Partial Call Graph (max 5 caller/called nodes):
%3 ad_try ad_try (public) apm_package_id_from_key apm_package_id_from_key (public) db_foreach db_foreach (public) lang::message::register lang::message::register (public) parameter::get parameter::get (public) lang::catalog::translate lang::catalog::translate lang::catalog::translate->ad_try lang::catalog::translate->apm_package_id_from_key lang::catalog::translate->db_foreach lang::catalog::translate->lang::message::register lang::catalog::translate->parameter::get

Testcases:
No testcase defined.

lang::catalog::uninitialized_packages (private)

 lang::catalog::uninitialized_packages

Return a list of keys for installed and enabled packages that do not have any message keys associated with them. This would suggest that either the package is not internationalized, or we have not yet imported the message keys for the package.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::catalog::import lang::catalog::import (public) lang::catalog::uninitialized_packages lang::catalog::uninitialized_packages lang::catalog::import->lang::catalog::uninitialized_packages db_list db_list (public) lang::catalog::uninitialized_packages->db_list

Testcases:
No testcase defined.
[ show source ]