[pacman-dev] display list i18n patch

Dan McGee dpmcgee at gmail.com
Mon Jul 2 13:52:21 EDT 2007


On 6/28/07, Sergej Pupykin <ps at lx-ltd.ru> wrote:
> Hi, All.
>
> I found that pacman output is not correctly formatted in multybyte
> locale. Here is a small patch. I hope it is correct...

Two comments:
1. Inline patches are a bit easier to review, that way we can comment
on the contents. I'll post it below and make my other comment.

diff -wbBur pacman-3.0.5/src/pacman/pacman.c pacman-3.0.5.my/src/pacman/pacman.c
--- pacman-3.0.5/src/pacman/pacman.c    2007-03-22 20:47:28.000000000 +0300
+++ pacman-3.0.5.my/src/pacman/pacman.c 2007-06-28 19:45:35.000000000 +0400
@@ -436,6 +436,11 @@
        MSG(NL, _("warning: current locale is invalid; using default
\"C\" locale"));
    }

+   if(getenv("LC_CTYPE") == NULL)
+   {
+       setlocale(LC_CTYPE, getenv("LC_ALL"));
+   }
+

^^ Why is this needed? This code has also changed quite a bit in the
GIT development of pacman, you may want to look there to see what i am
talking about.

    /* workaround for tr_TR */
    if(lang && !strcmp(lang, "tr_TR")) {
        setlocale(LC_CTYPE, "C");
diff -wbBur pacman-3.0.5/src/pacman/util.c pacman-3.0.5.my/src/pacman/util.c
--- pacman-3.0.5/src/pacman/util.c  2007-03-13 19:15:38.000000000 +0300
+++ pacman-3.0.5.my/src/pacman/util.c   2007-06-28 19:44:00.000000000 +0400
@@ -235,7 +235,7 @@
    alpm_list_t *i;
    int cols, len;

-   len = strlen(title);
+   len = mbstowcs(NULL, title, 0);
    printf("%s ", title);

    if(list) {


-Dan




More information about the pacman-dev mailing list