X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fhtml.c;h=e79c2a4cb45d239397a98c9bfe53bf1bdb4ef7f7;hb=49b52ead6d48488a4c1f90f372564c834da803cb;hp=2fd1eef4407f5291cf2e6cc7845eb05822efa5eb;hpb=b60e9c95703275bf2088ec2e398a9c47b30a89e7;p=ppastats.git diff --git a/src/html.c b/src/html.c index 2fd1eef..e79c2a4 100644 --- a/src/html.c +++ b/src/html.c @@ -17,6 +17,9 @@ 02110-1301 USA */ +#include +#define _(String) gettext(String) + #include #include #include @@ -28,6 +31,7 @@ #include "html.h" #include "io.h" +#include "log.h" #include "lp.h" #include "lp_ws.h" #include "ppastats.h" @@ -385,7 +389,7 @@ version_to_html(struct ppa_stats *ppa, f = fopen(path, "w"); if (!f) { - fprintf(stderr, "ERROR: failed to open: %s\n", path); + log_err(_("failed to open: %s"), path); return ; } @@ -410,7 +414,7 @@ create_html(const char *path, f = fopen(path, "w"); if (!f) { - fprintf(stderr, "ERROR: failed to open: %s\n", path); + log_err(_("failed to open: %s"), path); return ; } @@ -440,8 +444,8 @@ index_to_html(struct ppa_stats *ppa, const char *dir) json = ppa_to_json(ppa); json_path = path_new(dir, "index", ".json"); - if (debug) - printf("DEBUG: generating %s\n", json_path); + + log_debug(_("generating %s"), json_path); json_object_to_file(json_path, json); json_object_put(json); free(json_path); @@ -461,8 +465,8 @@ pkg_to_html(struct ppa_stats *ppa, struct package_stats *pkg, const char *dir) json_path = path_new(dir, pkg->name, ".json"); json = pkg_to_json(ppa, pkg); - if (debug) - printf("DEBUG: generating %s\n", json_path); + log_debug(_("generating %s"), json_path); + json_object_to_file(json_path, json); json_object_put(json); free(json_path); @@ -474,8 +478,7 @@ pkg_to_html(struct ppa_stats *ppa, struct package_stats *pkg, const char *dir) 1); sprintf(script, "ppastats_pkg(\"%s%s\");", pkg->name, ".json"); - if (debug) - printf("DEBUG: generating %s\n", path); + log_debug(_("generating %s"), path); create_html(path, pkg->name, HTML_PKG_TEMPLATE, script); free(path); @@ -538,9 +541,7 @@ ppa_to_html(const char *owner, for (i = 0; i < 7; i++) { f_dst = path_append(output_dir, www_files[2*i+1]); - if (debug) - printf("DEBUG: copying %s %s\n", - www_files[2*i], f_dst); + log_debug(_("copying %s %s"), www_files[2*i], f_dst); fcopy(www_files[2*i], f_dst); free(f_dst);