xgettext has a new option --kde that triggers the recognition and marking
of KDE 4 format strings.
+* libgettextpo library:
+ - New functions are available for querying the list of supported format
+ types.
+
* Documentation:
- The "Users" chapter has been completely rewritten.
- A complete example showing the use of GNU gettext in Java with the Qt/Jambi
+2007-10-21 Bruno Haible <bruno@clisp.org>
+
+ * gettext-po.h.in (LIBGETTEXTPO_VERSION): Bump version number.
+ (po_format_list, po_format_pretty_name): New declarations.
+ * gettext-po.c: Include xvasprintf.h.
+ (po_format_list, po_format_pretty_name): New functions.
+ Reported by Dwayne Bailey <dwayne@translate.org.za>.
+
2007-10-20 Bruno Haible <bruno@clisp.org>
* gettext-po.c (po_message_check_format): Update call to check_message,
#include "po-error.h"
#include "po-xerror.h"
#include "format.h"
+#include "xvasprintf.h"
#include "msgl-check.h"
#include "gettext.h"
}
+/* Return a NULL terminated array of the supported format types. */
+
+const char * const *
+po_format_list (void)
+{
+ static const char * const * whole_list /* = NULL */;
+ if (whole_list == NULL)
+ {
+ const char **list = XNMALLOC (NFORMATS + 1, const char *);
+ size_t i;
+ for (i = 0; i < NFORMATS; i++)
+ list[i] = xasprintf ("%s-format", format_language[i]);
+ list[i] = NULL;
+ whole_list = list;
+ }
+ return whole_list;
+}
+
+
+/* Return the pretty name associated with a format type.
+ For example, for "csharp-format", return "C#".
+ Return NULL if the argument is not a supported format type. */
+
+const char *
+po_format_pretty_name (const char *format_type)
+{
+ size_t len = strlen (format_type);
+ size_t i;
+
+ if (len >= 7 && memcmp (format_type + len - 7, "-format", 7) == 0)
+ for (i = 0; i < NFORMATS; i++)
+ if (strlen (format_language[i]) == len - 7
+ && memcmp (format_language[i], format_type, len - 7) == 0)
+ /* The given format_type corresponds to (enum format_type) i. */
+ return format_language_pretty[i];
+ return NULL;
+}
+
+
/* Test whether an entire file PO file is valid, like msgfmt does it.
If it is invalid, pass the reasons to the handler. */
/* Public API for GNU gettext PO files - contained in libgettextpo.
- Copyright (C) 2003-2006 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or modify
/* =========================== Meta Information ============================ */
/* Version number: (major<<16) + (minor<<8) + subminor */
-#define LIBGETTEXTPO_VERSION 0x001000
+#define LIBGETTEXTPO_VERSION 0x001002
extern int libgettextpo_version;
/* ================================= Types ================================= */
extern size_t po_filepos_start_line (po_filepos_t filepos);
+/* ============================ Format type API ============================= */
+
+/* Return a NULL terminated array of the supported format types. */
+extern const char * const * po_format_list (void);
+
+/* Return the pretty name associated with a format type.
+ For example, for "csharp-format", return "C#".
+ Return NULL if the argument is not a supported format type. */
+extern const char * po_format_pretty_name (const char *format_type);
+
+
/* ============================= Checking API ============================== */
/* Test whether an entire file PO file is valid, like msgfmt does it.