From: Ben Pfaff Date: Tue, 25 Dec 2018 17:58:42 +0000 (-0800) Subject: variable: Make property function return untranslated versions. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35717813005e999b6b807fc3f4bd6bb2d770f301;p=pspp variable: Make property function return untranslated versions. This makes it possible for the callers to do the translation at the time it is needed. It will be particularly useful in an upcoming commit. --- diff --git a/src/data/variable.c b/src/data/variable.c index 44f8a4fe40..14b122fee0 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -802,12 +802,13 @@ measure_is_valid (enum measure m) return m == MEASURE_NOMINAL || m == MEASURE_ORDINAL || m == MEASURE_SCALE; } -/* Returns a string version of measurement level M, for display to a user. */ +/* Returns a string version of measurement level M, for display to a user. + The caller may translate the string by passing it to gettext(). */ const char * measure_to_string (enum measure m) { assert (m == measure[m].value); - return gettext (measure[m].label); + return measure[m].label; } /* Returns a string version of measurement level M, for use in PSPP command @@ -887,12 +888,13 @@ var_role_is_valid (enum var_role role) } } -/* Returns a string version of ROLE, for display to a user. */ +/* Returns a string version of ROLE, for display to a user. + The caller may translate the string by passing it to gettext(). */ const char * var_role_to_string (enum var_role r) { assert (r == role[r].value); - return gettext (role[r].label); + return role[r].label; } /* Returns a string version of ROLE, for use in PSPP comamnd syntax. */ @@ -994,12 +996,13 @@ alignment_is_valid (enum alignment a) return a == ALIGN_LEFT || a == ALIGN_RIGHT || a == ALIGN_CENTRE; } -/* Returns a string version of alignment A, for display to a user. */ +/* Returns a string version of alignment A, for display to a user. + The caller may translate the string by passing it to gettext(). */ const char * alignment_to_string (enum alignment a) { assert (a == align[a].value); - return gettext (align[a].label); + return align[a].label; } /* Returns a string version of alignment A, for use in PSPP command syntax. */ diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index baea6274af..a0e6086232 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -466,10 +466,10 @@ display_variables (const struct variable **vl, size_t n, int flags) } if (flags & DF_MEASUREMENT_LEVEL) tab_text (t, x++, y, TAB_LEFT, - measure_to_string (var_get_measure (v))); + gettext (measure_to_string (var_get_measure (v)))); if (flags & DF_ROLE) tab_text (t, x++, y, TAB_LEFT, - var_role_to_string (var_get_role (v))); + gettext (var_role_to_string (var_get_role (v)))); if (flags & DF_WIDTH) { char s[INT_BUFSIZE_BOUND (int)]; @@ -478,7 +478,7 @@ display_variables (const struct variable **vl, size_t n, int flags) } if (flags & DF_ALIGNMENT) tab_text (t, x++, y, TAB_LEFT, - alignment_to_string (var_get_alignment (v))); + gettext (alignment_to_string (var_get_alignment (v)))); if (flags & DF_PRINT_FORMAT) { const struct fmt_spec *print = var_get_print_format (v);