poldek: poldek/pkgdir/pndir/description.c - utf8 (partially aplied...
mis
mis at pld-linux.org
Fri Jun 22 14:15:47 CEST 2007
Author: mis Date: Fri Jun 22 12:15:47 2007 GMT
Module: poldek Tag: HEAD
---- Log message:
- utf8 (partially aplied poldek-desc_in_utf8.patch by witekfl)
---- Files affected:
poldek/poldek/pkgdir/pndir:
description.c (1.5 -> 1.6)
---- Diffs:
================================================================
Index: poldek/poldek/pkgdir/pndir/description.c
diff -u poldek/poldek/pkgdir/pndir/description.c:1.5 poldek/poldek/pkgdir/pndir/description.c:1.6
--- poldek/poldek/pkgdir/pndir/description.c:1.5 Sat Oct 8 23:47:34 2005
+++ poldek/poldek/pkgdir/pndir/description.c Fri Jun 22 14:15:42 2007
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000 - 2005 Pawel A. Gajda <mis at k2.net.pl>
+ Copyright (C) 2000 - 2007 Pawel A. Gajda <mis at pld-linux.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2 as
@@ -91,6 +91,7 @@
const char *idstr, *langstr;
struct tndb *db;
+ DBGF("lang %s\n", lang);
pndir_db_dscr_idstr(lang, &idstr, &langstr);
if (*langstr == '\0')
@@ -164,8 +165,9 @@
/* start from the end => the last loaded one will be set as
pkguinf default (see pkguinf_restore_i18n()) */
for (i = n_array_size(langs) - 1; i >= 0; i--) {
+ const char *lang, *loaded_lang = NULL;
struct tndb *db;
- const char *lang;
+ char lang_utf8[32];
char dkey[512];
int dklen;
@@ -176,15 +178,26 @@
if ((db = pndir_db_dscr_h_get(db_dscr_h, lang)) == NULL)
continue;
- dklen = n_snprintf(dkey, sizeof(dkey), "%s%s", key, lang);
+ n_snprintf(lang_utf8, sizeof(lang_utf8), "%s.UTF-8", lang);
+ loaded_lang = lang_utf8;
+
+ dklen = n_snprintf(dkey, sizeof(dkey), "%s%s", key, lang_utf8);
vlen = tndb_get(db, dkey, dklen, val, sizeof(val));
- DBGF("ld %s: %s (%d)\n", pkg_snprintf_s(pkg), lang, vlen);
+
+ if (vlen == 0) { /* not exists */
+ dklen = n_snprintf(dkey, sizeof(dkey), "%s%s", key, lang);
+ vlen = tndb_get(db, dkey, dklen, val, sizeof(val));
+ loaded_lang = lang;
+ }
+
+ DBGF("ld %s: %s (%d)\n", pkg_id(pkg), loaded_lang ? loaded_lang : lang, vlen);
+
if (vlen > 0) {
tn_buf_it it;
n_buf_clean(nbuf);
n_buf_init(nbuf, val, vlen);
n_buf_it_init(&it, nbuf);
- pkguinf_restore_i18n(pkgu, &it, lang);
+ pkguinf_restore_i18n(pkgu, &it, loaded_lang);
}
}
}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/poldek/pkgdir/pndir/description.c?r1=1.5&r2=1.6&f=u
More information about the pld-cvs-commit
mailing list