From cf343a270e8ee01a492a1f14b2573c3c569b8c33 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 10 Sep 2015 18:45:47 +0900 Subject: [PATCH] xlocator, its: Add more comments --- gettext-tools/src/its.c | 16 ++++++++++++---- gettext-tools/src/its.h | 4 ++++ gettext-tools/src/xlocator.c | 1 + gettext-tools/src/xlocator.h | 8 ++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gettext-tools/src/its.c b/gettext-tools/src/its.c index 743ea82c0..09d10fc08 100644 --- a/gettext-tools/src/its.c +++ b/gettext-tools/src/its.c @@ -38,16 +38,23 @@ #define _(str) gettext (str) -/* The Internationalization Tag Set (ITS) 2.0 standard is published at: +/* The Internationalization Tag Set (ITS) 2.0 standard is available at: http://www.w3.org/TR/its20/ This implementation supports only a few data categories, useful for gettext-based projects. Other data categories can be added by - extending a class from its_rule_class_ty and registering it in + extending the its_rule_class_ty class and registering it in init_classes(). - The value associated with a data category is represented as an - array of key-value pairs. */ + The message extraction is done in three phases. In the first + phase, its_rule_list_apply() associates values to matching XML + elements in the target document. In the second phase, it traverses + the tree and marks translatable elements. In the final phase, it + extracts text contents from the marked elements. + + The values associated with an XML node are represented as an array + of key-value pairs, where both keys and values are string. The + values are stored in node->_private. */ #define ITS_NS "http://www.w3.org/2005/11/its" @@ -507,6 +514,7 @@ its_localization_note_rule_constructor (struct its_rule_ty *pop, xmlNode *node) its_value_list_append (&pop->values, "locNotePointer", prop); free (prop); } + /* FIXME: locNoteRef and locNoteRefPointer */ } struct its_value_list_ty * diff --git a/gettext-tools/src/its.h b/gettext-tools/src/its.h index ae2c04cb4..c9e5dec59 100644 --- a/gettext-tools/src/its.h +++ b/gettext-tools/src/its.h @@ -28,13 +28,17 @@ extern "C" { typedef struct its_rule_list_ty its_rule_list_ty; +/* Creates a fresh its_rule_list_ty holding global ITS rules. */ extern its_rule_list_ty *its_rule_list_alloc (void); +/* Releases memory allocated for RULES. */ extern void its_rule_list_free (its_rule_list_ty *rules); +/* Loads global ITS rules from FILENAME. */ extern bool its_rule_list_add_file (its_rule_list_ty *rules, const char *filename); +/* Extracts messages from FP, accoding to the loaded ITS rules. */ extern void its_rule_list_extract (its_rule_list_ty *rules, FILE *fp, const char *real_filename, const char *logical_filename, diff --git a/gettext-tools/src/xlocator.c b/gettext-tools/src/xlocator.c index 664f040d2..9afb44850 100644 --- a/gettext-tools/src/xlocator.c +++ b/gettext-tools/src/xlocator.c @@ -169,6 +169,7 @@ xlocator_list_resolve_target (struct xlocator_list_ty *locators, char *target_uri = NULL; char *result = NULL; + /* FIXME: Implement transformURI (the case locators->is_transform). */ if (!target->is_indirection) target_uri = xstrdup (target->uri); else diff --git a/gettext-tools/src/xlocator.h b/gettext-tools/src/xlocator.h index 3c0f55bb9..3ef85d068 100644 --- a/gettext-tools/src/xlocator.h +++ b/gettext-tools/src/xlocator.h @@ -27,11 +27,19 @@ extern "C" { typedef struct xlocator_list_ty xlocator_list_ty; +/* Creates a fresh xlocator_list_ty with the base URI BASE, and loads + the locating rules from the files in DIRECTORY. */ extern struct xlocator_list_ty *xlocator_list_alloc (const char *base, const char *directory); + +/* Determines the location of resource associated with PATH, accoding + to the loaded locating rules. If INSPECT_CONTENT is true, it also + checks the content of the file pointed by PATH. */ extern char *xlocator_list_locate (xlocator_list_ty *locators, const char *path, bool inspect_content); + +/* Releases memory allocated for LOCATORS. */ extern void xlocator_list_free (xlocator_list_ty *locators); #ifdef __cplusplus -- 2.47.2