On Sunday, June 23, 2013 3:27:39 PM UTC+4, Bram Moolenaar wrote:
> ZyX wrote:
>
> > # HG changeset patch
> > # User ZyX <[email protected]>
> > # Date 1371238936 -14400
> > # Fri Jun 14 23:42:16 2013 +0400
> > # Branch python-fixes
> > # Node ID abcf5d9458ee826516c1051cfd14d279b1097174
> > # Parent b9d4dfa09951d4fb75972df34802675edf24a17e
> > Make macros do translation of exception messages
> >
> > Reason: it will be easy to delete/restore translating
>
> Unfortunately this breaks all translations. E.g.:
>
> @@ -120,7 +122,7 @@
> }
> else
> {
> - PyErr_SetString(PyExc_TypeError, _("object must be string"));
> + PyErr_SET_STRING(PyExc_TypeError, "object must be string");
> return NULL;
> }
>
> This string will not be translated. It should have been:
>
> + PyErr_SET_STRING(PyExc_TypeError, N_("object must be string"));
>
> The N_() macro marks a string as translatable.
>
> I'll include this patch now, since otherwise there will be problems with
> all following patches. But please fix this ASAP.
I do not understand. `_()` was moved into the macros. How is
PyErr_SET_STRING(exc, "message") different from PyErr_SetString(exc,
_("message")) if macros `PyErr_SET_STRING(exc, msg)` is defined to
`PyErr_SetString(exc, _(msg))`?
If I need to have `N_()` there (in the macros definition) I will write a patch,
but I won't write `PyErr_SET_STRING(exc, N_(msg))`. It is the very intention:
move all _() out of the code to the macros in case I find some better argument
to not ever translate any exception messages then I have currently.
---
Just tested: translations do work. Steps to reproduce:
src/vim -u NONE -N -c 'lang ru_RU.UTF-8' -c 'py import vim' -c 'py
b=vim.current.buffer' -c 'bw!' -c 'py print b.name' a
. If this locale is supported it prints "vim.error: попытка сослаться на
уничтоженный буфер" in place of "vim.error: attempt to refer to deleted buffer".
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.