diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-10-06 08:55:58 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-10-06 10:42:32 -0700 |
commit | 4d3e74a23676a33ffdc04a4a8b83c05f63b2693c (patch) | |
tree | 23cff2046459ab33f32499e71e7caeb5892dbcd6 /profile.c | |
parent | 2c4ccc04bd384090917d7d17221012611426edb3 (diff) | |
download | subsurface-4d3e74a23676a33ffdc04a4a8b83c05f63b2693c.tar.gz |
Trying to switch to Qt translation
This compiles and looks about right, but it doesn't appear to work, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 69 |
1 files changed, 32 insertions, 37 deletions
@@ -2,12 +2,7 @@ /* creates all the necessary data for drawing the dive profile * uses cairo to draw it */ -#if 0 -#include <glib/gi18n.h> -#else -#define _(arg) arg -#define N_(arg) arg -#endif +#include "gettext.h" #include <limits.h> #include <string.h> @@ -135,7 +130,7 @@ int evn_foreach(void (*callback)(const char *, int *, void *), void *data) for (i = 0; i < evn_used; i++) { /* here we display an event name on screen - so translate */ - callback(_(ev_namelist[i].ev_name), &ev_namelist[i].plot_ev, data); + callback(tr(ev_namelist[i].ev_name), &ev_namelist[i].plot_ev, data); } return i; } @@ -1224,22 +1219,22 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize, double depthvalue, tempvalue, speedvalue; depthvalue = get_depth_units(depth, NULL, &depth_unit); - snprintf(buf, bufsize, _("D:%.1f %s"), depthvalue, depth_unit); + snprintf(buf, bufsize, tr("D:%.1f %s"), depthvalue, depth_unit); if (prefs.show_time) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60)); + snprintf(buf, bufsize, tr("%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60)); } if (pressure) { pressurevalue = get_pressure_units(pressure, &pressure_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nP:%d %s"), buf2, pressurevalue, pressure_unit); + snprintf(buf, bufsize, tr("%s\nP:%d %s"), buf2, pressurevalue, pressure_unit); } if (temp) { tempvalue = get_temp_units(temp, &temp_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nT:%.1f %s"), buf2, tempvalue, temp_unit); + snprintf(buf, bufsize, tr("%s\nT:%.1f %s"), buf2, tempvalue, temp_unit); } speedvalue = get_vertical_speed_units(abs(entry->speed), NULL, &vertical_speed_unit); @@ -1247,19 +1242,19 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize, /* Ascending speeds are positive, descending are negative */ if (entry->speed > 0) speedvalue *= -1; - snprintf(buf, bufsize, _("%s\nV:%.2f %s"), buf2, speedvalue, vertical_speed_unit); + snprintf(buf, bufsize, tr("%s\nV:%.2f %s"), buf2, speedvalue, vertical_speed_unit); if (entry->ceiling) { depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit); if (prefs.calc_all_tissues){ int k; for (k=0; k<16; k++){ if (entry->ceilings[k]){ depthvalue = get_depth_units(entry->ceilings[k], NULL, &depth_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit); } } } @@ -1270,62 +1265,62 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize, if (entry->ndl) { /* this is a safety stop as we still have ndl */ if (entry->stoptime) - snprintf(buf, bufsize, _("%s\nSafetystop:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60), + snprintf(buf, bufsize, tr("%s\nSafetystop:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60), depthvalue, depth_unit); else - snprintf(buf, bufsize, _("%s\nSafetystop:unkn time @ %.0f %s"), buf2, + snprintf(buf, bufsize, tr("%s\nSafetystop:unkn time @ %.0f %s"), buf2, depthvalue, depth_unit); } else { /* actual deco stop */ if (entry->stoptime) - snprintf(buf, bufsize, _("%s\nDeco:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60), + snprintf(buf, bufsize, tr("%s\nDeco:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60), depthvalue, depth_unit); else - snprintf(buf, bufsize, _("%s\nDeco:unkn time @ %.0f %s"), buf2, + snprintf(buf, bufsize, tr("%s\nDeco:unkn time @ %.0f %s"), buf2, depthvalue, depth_unit); } } else if (entry->in_deco) { /* this means we had in_deco set but don't have a stop depth */ memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nIn deco"), buf2); + snprintf(buf, bufsize, tr("%s\nIn deco"), buf2); } else if (has_ndl) { memcpy(buf2, buf, bufsize); if (entry->ndl == -1) - snprintf(buf, bufsize, _("%s\nNDL:-"), buf2); + snprintf(buf, bufsize, tr("%s\nNDL:-"), buf2); else - snprintf(buf, bufsize, _("%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60)); + snprintf(buf, bufsize, tr("%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60)); } if (entry->tts) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nTTS:%umin"), buf2, DIV_UP(entry->tts, 60)); + snprintf(buf, bufsize, tr("%s\nTTS:%umin"), buf2, DIV_UP(entry->tts, 60)); } if (entry->cns) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nCNS:%u%%"), buf2, entry->cns); + snprintf(buf, bufsize, tr("%s\nCNS:%u%%"), buf2, entry->cns); } if (prefs.pp_graphs.po2) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2); + snprintf(buf, bufsize, tr("%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2); } if (prefs.pp_graphs.pn2) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2); + snprintf(buf, bufsize, tr("%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2); } if (prefs.pp_graphs.phe) { memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\npHe:%.2fbar"), buf2, entry->phe); + snprintf(buf, bufsize, tr("%s\npHe:%.2fbar"), buf2, entry->phe); } if (prefs.mod) { mod = (int)get_depth_units(entry->mod, NULL, &depth_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nMOD:%d%s"), buf2, mod, depth_unit); + snprintf(buf, bufsize, tr("%s\nMOD:%d%s"), buf2, mod, depth_unit); } if (prefs.ead) { ead = (int)get_depth_units(entry->ead, NULL, &depth_unit); end = (int)get_depth_units(entry->end, NULL, &depth_unit); eadd = (int)get_depth_units(entry->eadd, NULL, &depth_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit); + snprintf(buf, bufsize, tr("%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit); } free(buf2); } @@ -1424,42 +1419,42 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int avg_depth /= stop->sec-start->sec; avg_speed /= stop->sec-start->sec; - snprintf(buf, bufsize, _("%sT: %d:%02d min"), UTF8_DELTA, delta_time/60, delta_time%60); + snprintf(buf, bufsize, tr("%sT: %d:%02d min"), UTF8_DELTA, delta_time/60, delta_time%60); memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(delta_depth, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sD:%.1f%s"), buf2, UTF8_DELTA, depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sD:%.1f%s"), buf2, UTF8_DELTA, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(min_depth, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sD:%.1f%s"), buf2, UTF8_DOWNWARDS_ARROW, depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sD:%.1f%s"), buf2, UTF8_DOWNWARDS_ARROW, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(max_depth, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sD:%.1f %s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sD:%.1f %s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(avg_depth, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sD:%.1f%s\n"), buf2, UTF8_AVERAGE, depthvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sD:%.1f%s\n"), buf2, UTF8_AVERAGE, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); speedvalue = get_depth_units(min_speed, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s%sV:%.2f%s/s"), buf2, UTF8_DOWNWARDS_ARROW, speedvalue, depth_unit); + snprintf(buf, bufsize, tr("%s%sV:%.2f%s/s"), buf2, UTF8_DOWNWARDS_ARROW, speedvalue, depth_unit); memcpy(buf2, buf, bufsize); speedvalue = get_depth_units(max_speed, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sV:%.2f%s/s"), buf2, UTF8_UPWARDS_ARROW, speedvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sV:%.2f%s/s"), buf2, UTF8_UPWARDS_ARROW, speedvalue, depth_unit); memcpy(buf2, buf, bufsize); speedvalue = get_depth_units(avg_speed, NULL, &depth_unit); - snprintf(buf, bufsize, _("%s %sV:%.2f%s/s"), buf2, UTF8_AVERAGE, speedvalue, depth_unit); + snprintf(buf, bufsize, tr("%s %sV:%.2f%s/s"), buf2, UTF8_AVERAGE, speedvalue, depth_unit); memcpy(buf2, buf, bufsize); /* Only print if gas has been used */ if (bar_used) { pressurevalue = get_pressure_units(bar_used, &pressure_unit); memcpy(buf2, buf, bufsize); - snprintf(buf, bufsize, _("%s %sP:%d %s"), buf2, UTF8_DELTA, pressurevalue, pressure_unit); + snprintf(buf, bufsize, tr("%s %sP:%d %s"), buf2, UTF8_DELTA, pressurevalue, pressure_unit); } free(buf2); |