Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- first, strip '.UTF-8' is needed for almost all apps using gettext, i found this: http://www.openwall.com/lists/musl/2016/05/11/81, but it seems nothing was added in musl.
- --- musl-1.1.16/src/locale/dcngettext.c 2017-01-01 03:27:17.000000000 +0000
- +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-01 03:27:17.000000000 +0000
- @@ -121,6 +121,7 @@
- struct __locale_struct *loc = CURRENT_LOCALE;
- const struct __locale_map *lm;
- const char *dirname, *locname, *catname;
- + char *posu;
- size_t dirlen, loclen, catlen, domlen;
- if ((unsigned)category >= LC_ALL) goto notrans;
- @@ -144,7 +143,10 @@
- catname = catnames[category];
- catlen = catlens[category];
- - loclen = strlen(locname);
- + if( posu = strstr(locname, ".UTF-8") )
- + loclen = posu - locname;
- + else
- + loclen = strlen(locname);
- size_t namelen = dirlen+1 + loclen+1 + catlen+1 + domlen+3;
- char name[namelen+1], *s = name;
- second, i compiled fcitx with musl's intl, parts of text is translated but other parts. I gone through the whole progranm, finally found this mistake. p refers to the list to add, so the return value of strcmp() is always 0, when bindtextdomain executes more than onetime, active flag is set to 0 wrongly.
- --- musl-1.1.16/src/locale/dcngettext.c 2017-01-20 10:43:48.054441176 +0000
- +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-20 10:43:48.054441176 +0000
- @@ -74,7 +74,7 @@
- a_store(&p->active, 1);
- for (q=bindings; q; q=q->next) {
- - if (!strcmp(p->domainname, domainname) && q != p)
- + if (!strcmp(q->domainname, domainname) && q != p)
- a_store(&q->active, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement