[vim/vim] Untranslated strings in the append_arg_number() function of the buffer.c file (Issue #12429)

8 views
Skip to first unread message

Restorer

unread,
May 23, 2023, 10:34:35 AM5/23/23
to vim/vim, Subscribed

Steps to reproduce

The text "file 1 of 2", displayed in the window title, status bar and command line when editing multiple files, is not available for translation.

It is possible that the append_arg_number() function in the buffer.c file should look like this:

diff --git "a/src/buffer.c" "b/src/buffer.c"
index ff7c50fae..777f9ee92 100644
--- "a/src/buffer.c"
+++ "b/src/buffer.c"
@@ -5279,6 +5279,7 @@ append_arg_number(
     int		add_file)	// Add "file" before the arg number
 {
     char_u	*p;
+    char	*txt;
 
     if (ARGCOUNT <= 1)		// nothing to do
 	return FALSE;
@@ -5290,12 +5291,13 @@ append_arg_number(
     *p++ = '(';
     if (add_file)
     {
-	STRCPY(p, "file ");
-	p += 5;
+	txt = _("file ")
+	STRCPY(p, _(txt));
+	p += STRLEN(_(txt));
     }
     vim_snprintf((char *)p, (size_t)(buflen - (p - buf)),
-		wp->w_arg_idx_invalid ? "(%d) of %d)"
-				  : "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT);
+		wp->w_arg_idx_invalid ? _("(%d) of %d)")
+				: _("%d of %d)"), wp->w_arg_idx + 1, ARGCOUNT);
     return TRUE;
 }

I don't know the C programming language very well. I made it in the form of a patch, so fix it if anything.

Expected behaviour

Availability for translation

Version of Vim

9.0.1572

Environment

Windows 6.1

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12429@github.com>

Bram Moolenaar

unread,
May 23, 2023, 1:00:25 PM5/23/23
to vim/vim, Subscribed


> ### Steps to reproduce

>
> The text "file 1 of 2", displayed in the window title, status bar and
> command line when editing multiple files, is not available for
> translation.
>
> It is possible that the [append_arg_number()](https://github.com/vim/vim/blob/d4a9b7f61475f3166cce92b0bad748e8c1eb51fe/src/buffer.c#L5275) function in the buffer.c file should look like this:
For translations it is generally not a good idea to split up a text in
parts and translate each part separately. Unfortunately, in this case
we end up with four strings, depending on "add_file"
and "w_arg_idx_invalid":

"(%d of %d)"
"((%d) of %d)"
"(file %d of %d)"
"(file (%d) of %d)"

The length check can then be done by vim_snprintf() and the condition
with the comment "getting too long" can be dropped, that makes it a bit
simpler.

Now that I looked at it I might as well make a patch for it...


--
Q: Should I clean my house or work on Vim?
A: Whatever contains more bugs.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12429/1559827984@github.com>

Bram Moolenaar

unread,
May 23, 2023, 1:02:39 PM5/23/23
to vim/vim, Subscribed

Closed #12429 as completed via a8490a4.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/12429/issue_event/9318810657@github.com>

Christ van Willegen

unread,
May 23, 2023, 1:11:10 PM5/23/23
to vim...@googlegroups.com, reply+ACY5DGF44P6BBSEEWA...@reply.github.com, vim/vim, Subscribed
On Tue, May 23, 2023 at 7:00 PM Bram Moolenaar <vim-dev...@256bit.org> wrote:

For translations it is generally not a good idea to split up a text in
parts and translate each part separately.

It would also stop them from changing the word order for different translations.

While you are looking at translations, could you advise me on how to proceed with PR #12140 ? CodeCov tells me that it drops coverage a lot, but I disagree with the computer :-)

Christ van Willegen

vim-dev ML

unread,
May 23, 2023, 1:11:28 PM5/23/23
to vim/vim, vim-dev ML, Your activity

On Tue, May 23, 2023 at 7:00 PM Bram Moolenaar ***@***.***>

wrote:

> For translations it is generally not a good idea to split up a text in
> parts and translate each part separately.


It would also stop them from changing the word order for different
translations.

While you are looking at translations, could you advise me on how to
proceed with PR #12140 ? CodeCov tells me that it drops coverage a lot, but
I disagree with the computer :-)

Christ van Willegen


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12429/1559843118@github.com>

Bram Moolenaar

unread,
May 23, 2023, 6:02:25 PM5/23/23
to vim...@googlegroups.com, Christ van Willegen, reply+ACY5DGF44P6BBSEEWA...@reply.github.com
That PR is in the todo list. It's probably OK, but I still need to look
at the details. I'm still working away bug reports (some of which are
time consuming).

We have seen before that coverage reports on PRs is unreliable. You can
have a look at it, but feel free to disagree :-). Better have another
look after the PR has been included.

--
hundred-and-one symptoms of being an internet addict:
61. Your best friends know your e-mail address, but neither your phone number
nor the address where you live.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\

vim-dev ML

unread,
May 23, 2023, 6:02:40 PM5/23/23
to vim/vim, vim-dev ML, Your activity


> On Tue, May 23, 2023 at 7:00 PM Bram Moolenaar ***@***.***>

> wrote:
>
> > For translations it is generally not a good idea to split up a text in
> > parts and translate each part separately.
>
> It would also stop them from changing the word order for different
> translations.
>
> While you are looking at translations, could you advise me on how to
> proceed with PR #12140 ? CodeCov tells me that it drops coverage a
> lot, but I disagree with the computer :-)

That PR is in the todo list. It's probably OK, but I still need to look
at the details. I'm still working away bug reports (some of which are
time consuming).

We have seen before that coverage reports on PRs is unreliable. You can
have a look at it, but feel free to disagree :-). Better have another
look after the PR has been included.

--
hundred-and-one symptoms of being an internet addict:
61. Your best friends know your e-mail address, but neither your phone number
nor the address where you live.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\

/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12429/1560184577@github.com>

Reply all
Reply to author
Forward
0 new messages