diff options
| author | Peter Eisentraut | 2003-05-27 19:36:55 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2003-05-27 19:36:55 +0000 |
| commit | 4bddc3a5b342dbf99caa787e7c331a49d3ddbc36 (patch) | |
| tree | de0a96ed913e0118ebce1ce39dfc29db4c9ebde2 /src/bin/scripts/common.c | |
| parent | 8619d5678ec3b4a779927d3ddc6a56b4718ad55a (diff) | |
Internationalize interactive yes/no responses.
Diffstat (limited to 'src/bin/scripts/common.c')
| -rw-r--r-- | src/bin/scripts/common.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 718479f54f..a3a293d32c 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -153,3 +153,24 @@ executeQuery(PGconn *conn, const char *query, const char *progname, bool echo) return res; } + + +/* + * Check yes/no answer in a localized way. 1=yes, 0=no, -1=neither. + */ + +/* translator: Make sure the (y/n) prompts match the translation of this. */ +#define PG_YESLETTER gettext_noop("y") +/* translator: Make sure the (y/n) prompts match the translation of this. */ +#define PG_NOLETTER gettext_noop("n") + +int +check_yesno_response(const char *string) +{ + if (strcmp(string, gettext(PG_YESLETTER)) == 0) + return 1; + else if (strcmp(string, gettext(PG_NOLETTER)) == 0) + return 0; + else + return -1; +} |
