Loading ...
Sorry, an error occurred while loading the content.

71464Re: [PATCH] (4/7) Consistency and refactoring

Expand Messages
  • Bram Moolenaar
    Jun 23, 2013
    • 0 Attachment
      ZyX wrote:

      > > > # HG changeset patch
      > > > # User ZyX <kp-pav@...>
      > > > # 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".

      Please follow my instructions. gettext searches the source code for
      "_()" and "N_()", nothing else. After patch 7.3.1229 existing
      translations will work, but the next time the translations are updated
      they will be gone.

      You can see the effect by running "make ru" in src/po.

      --
      A cow comes flying over the battlements, lowing aggressively. The cow
      lands on GALAHAD'S PAGE, squashing him completely.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 25 messages in this topic