* Guess the user's preferred languages from the value in LANGUAGE environment * variable and LC_MESSAGES locale category if NO_GETTEXT is not defined. * * The result can be a colon-separated list like "ko:ja:en". */
| 48 | * The result can be a colon-separated list like "ko:ja:en". |
| 49 | */ |
| 50 | const char *get_preferred_languages(void) |
| 51 | { |
| 52 | const char *retval; |
| 53 | |
| 54 | retval = getenv("LANGUAGE"); |
| 55 | if (retval && *retval) |
| 56 | return retval; |
| 57 | |
| 58 | #ifndef NO_GETTEXT |
| 59 | retval = setlocale(LC_MESSAGES, NULL); |
| 60 | if (retval && *retval && |
| 61 | strcmp(retval, "C") && |
| 62 | strcmp(retval, "POSIX")) |
| 63 | return retval; |
| 64 | #endif |
| 65 | |
| 66 | return NULL; |
| 67 | } |
| 68 | |
| 69 | #ifndef NO_GETTEXT |
| 70 | __attribute__((format (printf, 1, 2))) |
no outgoing calls
no test coverage detected