Whoa, whoa, whoa. Let's slow down and think about this carefully.
I'm not sure r31600 is a generally applicable solution. After all, a
translation might be longer instead of shorter.
Instead, perhaps we have to write multiline prompts in a way that allows
translations to work regardless of word length. I don't think counting
characters is the way to go, unless there's no other solution.
Do you know of any other places in Subversion that have this problem?
-Karl
Jens Seidel <jensseidel_at_users.sf.net> writes:
> OK, there is indeed similar code in trunk and I prepared a patch which
> fixes the indentation (but should not be backported so r31600 is fine) from:
>
> Auswahl: (p) zurückstellen, (df) voller Diff, (e) editieren,
> (mc) mine-conflict, (tc) theirs-conflict,
> (s) show all options:
>
> to
>
> Auswahl: (p) zurückstellen, (df) voller Diff, (e) editieren,
> (mc) mine-conflict, (tc) theirs-conflict,
> (s) show all options:
>
> Nevertheless I need help as I'm really not comfortable with apr. I did
> not even find good documentation (only
> http://apr.apache.org/docs/apr/1.3, nothing about pool usage ...).
>
> How can I count the number of characters in a string? strlen would
> return a too large value because of multi-byte characters.
>
> See the attached patch for details.
>
> [[[
> Fixed indentation of the translated merge conflict resolution menu.
>
> * subversion/svn/conflict-callbacks.c
> (svn_cl__conflict_handler):
> The code didn't respect that translations of "Select: " could have another
> length than 8 (the English one). That's why further shortcuts were wrongly
> aligned.
> ]]]
>
> Index: subversion/svn/conflict-callbacks.c
> ===================================================================
> --- subversion/svn/conflict-callbacks.c (Revision 31602)
> +++ subversion/svn/conflict-callbacks.c (Arbeitskopie)
> @@ -427,8 +427,16 @@
> {
> svn_pool_clear(subpool);
>
> - prompt = apr_pstrdup(subpool, _("Select: (p) postpone"));
> + char *indentation = apr_pstrdup(subpool, "");
> + int i;
> + // FIXME: strlen() is too large for multi-byte streams! How to
> + // count characters (not bytes)?
> + for (i=0; i<strlen(_("Select: ")); ++i)
> + indentation = apr_pstrcat(subpool, indentation, " ", NULL);
>
> + prompt = apr_pstrdup(subpool, _("Select: "));
> + prompt = apr_pstrcat(subpool, prompt, _("(p) postpone"), NULL);
> +
> if (diff_allowed)
> {
> prompt = apr_pstrcat(subpool, prompt,
> @@ -441,23 +449,29 @@
>
> if (! desc->is_binary &&
> desc->kind != svn_wc_conflict_kind_property)
> - prompt = apr_pstrcat(subpool, prompt,
> - _(",\n (mc) mine-conflict, "
> - "(tc) theirs-conflict"),
> - NULL);
> + {
> + prompt = apr_pstrcat(subpool, prompt, _(",\n"), NULL);
> + prompt = apr_pstrcat(subpool, prompt, indentation, NULL);
> + prompt = apr_pstrcat(subpool, prompt,
> + _("(mc) mine-conflict, "
> + "(tc) theirs-conflict"),
> + NULL);
> + }
> }
> else
> {
> if (knows_something)
> prompt = apr_pstrcat(subpool, prompt, _(", (r) resolved"),
> NULL);
> + prompt = apr_pstrcat(subpool, prompt, _(",\n"), NULL);
> + prompt = apr_pstrcat(subpool, prompt, indentation, NULL);
> prompt = apr_pstrcat(subpool, prompt,
> - _(",\n "
> - "(mf) mine-full, (tf) theirs-full"),
> + _("(mf) mine-full, (tf) theirs-full"),
> NULL);
> }
>
> - prompt = apr_pstrcat(subpool, prompt, ",\n ", NULL);
> + prompt = apr_pstrcat(subpool, prompt, _(",\n"), NULL);
> + prompt = apr_pstrcat(subpool, prompt, indentation, NULL);
> prompt = apr_pstrcat(subpool, prompt,
> _("(s) show all options: "),
> NULL);
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: dev-help_at_subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-06-06 00:17:47 CEST