lmessages.c (b161fb00618582eb3982d45529da41cf51b25f69) | lmessages.c (39d2c772eb664055f6c5184eb52fba0f78e6897f) |
---|---|
1/* 2 * Copyright (c) 2001 Alexey Zelkin 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 47static struct lc_messages_T _messages_locale; 48static int _messages_using_locale; 49static char * messages_locale_buf; 50 51int 52__messages_load_locale(const char *name) { 53 | 1/* 2 * Copyright (c) 2001 Alexey Zelkin 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 47static struct lc_messages_T _messages_locale; 48static int _messages_using_locale; 49static char * messages_locale_buf; 50 51int 52__messages_load_locale(const char *name) { 53 |
54 int ret; 55 ret = __part_load_locale(name, &_messages_using_locale, 56 messages_locale_buf, "LC_MESSAGES", LCMESSAGES_SIZE_FULL, | 54 /* Propose that we can have incomplete locale file (w/o "{yes,no}str"). 55 Initialize them before loading. In case of complete locale, they'll 56 be initialized to loaded value, otherwise they'll not be touched. */ 57 _messages_locale.yesstr = empty; 58 _messages_locale.nostr = empty; 59 60 return __part_load_locale(name, &_messages_using_locale, 61 messages_locale_buf, "LC_MESSAGES", 62 LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN, |
57 (const char **)&_messages_locale); | 63 (const char **)&_messages_locale); |
58 if (ret == 0) { 59 /* Assume that we have incomplete locale file (without 60 * "yesstr" and "nostr" declared. Try it also. 61 */ 62 ret = __part_load_locale(name, &_messages_using_locale, 63 messages_locale_buf, "LC_MESSAGES", LCMESSAGES_SIZE_MIN, 64 (const char **)&_messages_locale); 65 if (ret == 0) { 66 _messages_locale.yesstr = empty; 67 _messages_locale.nostr = empty; 68 } 69 } 70 return ret; | |
71} 72 73struct lc_messages_T * 74__get_current_messages_locale(void) { 75 76 return (_messages_using_locale 77 ? &_messages_locale 78 : (struct lc_messages_T *)&_C_messages_locale); --- 16 unchanged lines hidden --- | 64} 65 66struct lc_messages_T * 67__get_current_messages_locale(void) { 68 69 return (_messages_using_locale 70 ? &_messages_locale 71 : (struct lc_messages_T *)&_C_messages_locale); --- 16 unchanged lines hidden --- |