|
|
5523e9 |
diff --git a/lib/tagexts.c b/lib/tagexts.c
|
|
|
5523e9 |
index dc0e0fb..e0a5d1f 100644
|
|
|
5523e9 |
--- a/lib/tagexts.c
|
|
|
5523e9 |
+++ b/lib/tagexts.c
|
|
|
5523e9 |
@@ -478,59 +478,29 @@ static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
|
|
|
5523e9 |
*/
|
|
|
5523e9 |
static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
|
|
|
5523e9 |
{
|
|
|
5523e9 |
- int rc;
|
|
|
5523e9 |
+ int rc = headerGet(h, tag, td, HEADERGET_ALLOC);
|
|
|
5523e9 |
#if defined(ENABLE_NLS)
|
|
|
5523e9 |
- char * dstring = rpmExpand(_macro_i18ndomains, NULL);
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- td->type = RPM_STRING_TYPE;
|
|
|
5523e9 |
- td->data = NULL;
|
|
|
5523e9 |
- td->count = 0;
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- if (dstring && *dstring) {
|
|
|
5523e9 |
- char *domain, *de;
|
|
|
5523e9 |
- const char * langval;
|
|
|
5523e9 |
- char * msgkey;
|
|
|
5523e9 |
- const char * msgid;
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- rasprintf(&msgkey, "%s(%s)", headerGetString(h, RPMTAG_NAME),
|
|
|
5523e9 |
- rpmTagGetName(tag));
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- /* change to en_US for msgkey -> msgid resolution */
|
|
|
5523e9 |
- langval = getenv(language);
|
|
|
5523e9 |
- (void) setenv(language, "en_US", 1);
|
|
|
5523e9 |
- ++_nl_msg_cat_cntr;
|
|
|
5523e9 |
+ if (rc) {
|
|
|
5523e9 |
+ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL);
|
|
|
5523e9 |
+ const char *domain;
|
|
|
5523e9 |
|
|
|
5523e9 |
- msgid = NULL;
|
|
|
5523e9 |
for (domain = dstring; domain != NULL; domain = de) {
|
|
|
5523e9 |
+ const char *msgid = td->data;
|
|
|
5523e9 |
+ const char *msg = NULL;
|
|
|
5523e9 |
+
|
|
|
5523e9 |
de = strchr(domain, ':');
|
|
|
5523e9 |
if (de) *de++ = '\0';
|
|
|
5523e9 |
- msgid = dgettext(domain, msgkey);
|
|
|
5523e9 |
- if (msgid != msgkey) break;
|
|
|
5523e9 |
- }
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- /* restore previous environment for msgid -> msgstr resolution */
|
|
|
5523e9 |
- if (langval)
|
|
|
5523e9 |
- (void) setenv(language, langval, 1);
|
|
|
5523e9 |
- else
|
|
|
5523e9 |
- unsetenv(language);
|
|
|
5523e9 |
- ++_nl_msg_cat_cntr;
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- if (domain && msgid) {
|
|
|
5523e9 |
- td->data = dgettext(domain, msgid);
|
|
|
5523e9 |
- td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */
|
|
|
5523e9 |
- td->count = 1;
|
|
|
5523e9 |
- td->flags = RPMTD_ALLOCED;
|
|
|
5523e9 |
+ msg = dgettext(domain, td->data);
|
|
|
5523e9 |
+ if (msg != msgid) {
|
|
|
5523e9 |
+ free(td->data);
|
|
|
5523e9 |
+ td->data = xstrdup(msg);
|
|
|
5523e9 |
+ break;
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
}
|
|
|
5523e9 |
- dstring = _free(dstring);
|
|
|
5523e9 |
- free(msgkey);
|
|
|
5523e9 |
- if (td->data)
|
|
|
5523e9 |
- return 1;
|
|
|
5523e9 |
+ free(dstring);
|
|
|
5523e9 |
}
|
|
|
5523e9 |
-
|
|
|
5523e9 |
- free(dstring);
|
|
|
5523e9 |
#endif
|
|
|
5523e9 |
|
|
|
5523e9 |
- rc = headerGet(h, tag, td, HEADERGET_ALLOC);
|
|
|
5523e9 |
return rc;
|
|
|
5523e9 |
}
|
|
|
5523e9 |
|