Hi,
We can remove textdomain(PACKAGE_NAME) by replacing all
gettext(x) with dgettext(PACKAGE_NAME, x).
textdomain(PACKAGE_NAME) sets PACKAGE_NAME to the current
message domain. This is not good thing for svn library
users. Some users who assume that their current message
domain is MY_PACKAGE_NAME may get some troubles.
And gettext(x) call may cause some troubles when svn library
user changes the current message domain to MY_PACKAGE_NAME.
[[[
Remove textdomain(), gettext() and dgettext(). Use _()
instead of gettext() and dgettext().
* subversion/include/svn_nls.h (svn_nls_environment_init),
* subversion/libsvn_subr/nls.c (svn_nls_environment_init):
Rename to svn_nls_init() and override.
* subversion/libsvn_subr/io.c (do_io_file_wrapper_cleanup),
* subversion/clients/cmdline/help-cmd.c (svn_cl__help):
Use _() instead of gettext().
* subversion/libsvn_subr/error.c (svn_strerror),
* subversion/libsvn_subr/opt.c
(print_command_info,
svn_opt_format_option):
Use _() instead of dgettext().
]]]
NOTE: _(x) macro is defined as dgettext(PACKAGE_NAME, x)
Thanks,
--
kou
Index: subversion/include/svn_nls.h
===================================================================
--- subversion/include/svn_nls.h (revision 15374)
+++ subversion/include/svn_nls.h (working copy)
@@ -28,7 +28,7 @@
extern "C" {
#endif /* __cplusplus */
-/** Set up the NLS environment.
+/** Set up the NLS.
* Return the error @c APR_EINVAL or @c APR_INCOMPLETE if an
* error occurs.
*
@@ -39,19 +39,6 @@
*
* @since New in 1.3.
*/
-svn_error_t *svn_nls_environment_init (void);
-
-/** Set up the NLS which includes NLS environment set up.
- * Return the error @c APR_EINVAL or @c APR_INCOMPLETE if an
- * error occurs.
- *
- * @note This function is for bindings. You should usually
- * use svn_cmdline_init() instead of calling this
- * function directly. This function should be called
- * after initializing APR.
- *
- * @since New in 1.3.
- */
svn_error_t *svn_nls_init (void);
#ifdef __cplusplus
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 15373)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2195,10 +2195,10 @@
svn_error_clear (err);
if (name)
- return svn_error_wrap_apr (status, gettext(msg),
+ return svn_error_wrap_apr (status, _(msg),
svn_path_local_style (name, pool));
else
- return svn_error_wrap_apr (status, gettext(msg_no_name));
+ return svn_error_wrap_apr (status, _(msg_no_name));
}
Index: subversion/libsvn_subr/error.c
===================================================================
--- subversion/libsvn_subr/error.c (revision 15373)
+++ subversion/libsvn_subr/error.c (working copy)
@@ -437,7 +437,7 @@
for (defn = error_table; defn->errdesc != NULL; ++defn)
if (defn->errcode == (svn_errno_t)statcode)
{
- apr_cpystrn (buf, dgettext (PACKAGE_NAME, defn->errdesc), bufsize);
+ apr_cpystrn (buf, _(defn->errdesc), bufsize);
return buf;
}
Index: subversion/libsvn_subr/nls.c
===================================================================
--- subversion/libsvn_subr/nls.c (revision 15374)
+++ subversion/libsvn_subr/nls.c (working copy)
@@ -43,7 +43,7 @@
svn_error_t *
-svn_nls_environment_init (void)
+svn_nls_init (void)
{
svn_error_t *err = SVN_NO_ERROR;
@@ -125,14 +125,3 @@
return err;
}
-
-svn_error_t *
-svn_nls_init (void)
-{
-#ifdef ENABLE_NLS
- SVN_ERR (svn_nls_environment_init ());
- textdomain (PACKAGE_NAME);
-#endif
-
- return SVN_NO_ERROR;
-}
Index: subversion/libsvn_subr/opt.c
===================================================================
--- subversion/libsvn_subr/opt.c (revision 15373)
+++ subversion/libsvn_subr/opt.c (working copy)
@@ -134,8 +134,7 @@
const apr_getopt_option_t *option;
svn_boolean_t have_options = FALSE;
- SVN_ERR (svn_cmdline_fprintf (stream, pool, ": %s",
- dgettext (PACKAGE_NAME, cmd->help)));
+ SVN_ERR (svn_cmdline_fprintf (stream, pool, ": %s", _(cmd->help)));
/* Loop over all valid option codes attached to the subcommand */
for (i = 0; i < SVN_OPT_MAX_OPTIONS; i++)
@@ -237,8 +236,7 @@
opts = apr_pstrcat (pool, opts, _(" arg"), NULL);
if (doc)
- opts = apr_psprintf (pool, "%-24s : %s", opts,
- dgettext( PACKAGE_NAME, opt->description));
+ opts = apr_psprintf (pool, "%-24s : %s", opts, _(opt->description));
*string = opts;
}
Index: subversion/clients/cmdline/help-cmd.c
===================================================================
--- subversion/clients/cmdline/help-cmd.c (revision 15373)
+++ subversion/clients/cmdline/help-cmd.c (working copy)
@@ -57,7 +57,7 @@
"For additional information, see http://subversion.tigris.org/\n");
char *help_header =
- apr_psprintf (pool, gettext (help_header_template), SVN_VER_NUMBER);
+ apr_psprintf (pool, _(help_header_template), SVN_VER_NUMBER);
const char *ra_desc_start
= _("The following repository access (RA) modules are available:\n\n");
@@ -80,6 +80,6 @@
help_header, /* already gettext()'d */
svn_cl__cmd_table,
svn_cl__options,
- gettext (help_footer),
+ _(help_footer),
pool);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 22 10:03:27 2005