/* * We allow LC_MESSAGES to actually be set globally. * * Note: we normally disallow value = "" because it wouldn't have consistent * semantics (it'd effectively just use the previous value). However, this * is the value passed for PGC_S_DEFAULT, so don't complain in that case, * not even if the attempted setting fails due to invalid environment value. * The idea there is just to accept the environment setting *if possible* * during startup, until we can read the proper value from postgresql.conf. */ const char * locale_messages_assign(const char *value, bool doit, GucSource source) { if (*value == '\0' && source != PGC_S_DEFAULT) return NULL; /* * LC_MESSAGES category does not exist everywhere, but accept it anyway * * On Windows, we can't even check the value, so the non-doit case is a * no-op */ #ifdef LC_MESSAGES if (doit) { if (!pg_perm_setlocale(LC_MESSAGES, value)) if (source != PGC_S_DEFAULT) return NULL; } #ifndef WIN32 else value = locale_xxx_assign(LC_MESSAGES, value, false, source); #endif /* WIN32 */ #endif /* LC_MESSAGES */ return value; }
/* * We allow LC_MESSAGES to actually be set globally. */ const char * locale_messages_assign(const char *value, bool doit, bool interactive) { /* * LC_MESSAGES category does not exist everywhere, but accept it * anyway */ #ifdef LC_MESSAGES if (doit) { if (!setlocale(LC_MESSAGES, value)) return NULL; } else value = locale_xxx_assign(LC_MESSAGES, value, false, interactive); #endif return value; }
const char * locale_time_assign(const char *value, bool doit, GucSource source) { return locale_xxx_assign(LC_TIME, value, doit, source); }
const char * locale_numeric_assign(const char *value, bool doit, GucSource source) { return locale_xxx_assign(LC_NUMERIC, value, doit, source); }
const char * locale_monetary_assign(const char *value, bool doit, GucSource source) { return locale_xxx_assign(LC_MONETARY, value, doit, source); }
const char * locale_time_assign(const char *value, bool doit, bool interactive) { return locale_xxx_assign(LC_TIME, value, doit, interactive); }
const char * locale_numeric_assign(const char *value, bool doit, bool interactive) { return locale_xxx_assign(LC_NUMERIC, value, doit, interactive); }
const char * locale_monetary_assign(const char *value, bool doit, bool interactive) { return locale_xxx_assign(LC_MONETARY, value, doit, interactive); }