indent i18n.c i18n.h

This commit is contained in:
Bill Kendrick 2017-10-15 10:56:18 -07:00
parent 967d37d8a7
commit 5b4e0dd53f
2 changed files with 365 additions and 364 deletions

View file

@ -428,9 +428,8 @@ static void show_lang_usage(int exitcode)
{
FILE *f = exitcode ? stderr : stdout;
const char *const prg = "tuxpaint";
fprintf(f,
"\n"
"Usage: %s [--lang LANGUAGE]\n" "\n" "LANGUAGE may be one of:\n"
fprintf(f, "\n" "Usage: %s [--lang LANGUAGE]\n" "\n" "LANGUAGE may be one of:\n"
/* C */ " english american-english\n"
/* ach */ " acholi acoli\n"
/* af */ " afrikaans\n"
@ -699,10 +698,7 @@ static void show_locale_usage(FILE * f, const char *const prg)
" wa_BE (Walloon)\n"
" wo_SN (Wolof)\n"
" cy_GB (Welsh Cymraeg)\n"
" xh_ZA (Xhosa)\n"
" zam (Zapoteco-Miahuatlan)\n"
" zu_ZA (Zulu)\n"
"\n", prg);
" xh_ZA (Xhosa)\n" " zam (Zapoteco-Miahuatlan)\n" " zu_ZA (Zulu)\n" "\n", prg);
}
@ -734,7 +730,9 @@ static void ctype_utf8(void)
A zapotec speaker may have es_MX.UTF-8 available but not have en_US.UTF-8 for example */
const char *names[] = { "en_US.UTF8", "en_US.UTF-8", "UTF8", "UTF-8", "C.UTF-8" };
int i = sizeof(names) / sizeof(names[0]);
for(;;){
for (;;)
{
if (iswprint((wchar_t) 0xf7)) // division symbol -- which is in Latin-1 :-/
return;
if (--i < 0)
@ -750,6 +748,7 @@ static void ctype_utf8(void)
static const char *language_to_locale(const char *langstr)
{
int i = sizeof language_to_locale_array / sizeof language_to_locale_array[0];
while (i--)
{
if (!strcmp(langstr, language_to_locale_array[i].language))
@ -774,6 +773,7 @@ static void set_langint_from_locale_string(const char *restrict loc)
size_t len_baseloc;
int found = 0;
int i;
// printf("langint %i\n", langint);
if (!loc)
@ -810,8 +810,7 @@ static void set_langint_from_locale_string(const char *restrict loc)
for (i = 0; i < NUM_LANGS && found == 0; i++)
{
// Case-insensitive (both "pt_BR" and "pt_br" work, etc.)
if (len_baseloc == strlen(lang_prefixes[i]) &&
!strncasecmp(straux, lang_prefixes[i], len_baseloc))
if (len_baseloc == strlen(lang_prefixes[i]) && !strncasecmp(straux, lang_prefixes[i], len_baseloc))
{
langint = i;
found = 1;
@ -826,8 +825,7 @@ static void set_langint_from_locale_string(const char *restrict loc)
for (i = 0; i < NUM_LANGS && found == 0; i++)
{
// Case-insensitive (both "pt_BR" and "pt_br" work, etc.)
if (len_baseloc == strlen(lang_prefixes[i]) &&
!strncasecmp(straux, lang_prefixes[i], len_baseloc))
if (len_baseloc == strlen(lang_prefixes[i]) && !strncasecmp(straux, lang_prefixes[i], len_baseloc))
{
langint = i;
found = 1;
@ -864,8 +862,7 @@ static void set_langint_from_locale_string(const char *restrict loc)
for (i = 0; i < NUM_LANGS && found == 0; i++)
{
// Case-insensitive (both "pt_BR" and "pt_br" work, etc.)
if (len_baseloc == strlen(lang_prefixes[i]) &&
!strncasecmp(baseloc, lang_prefixes[i], strlen(lang_prefixes[i])))
if (len_baseloc == strlen(lang_prefixes[i]) && !strncasecmp(baseloc, lang_prefixes[i], strlen(lang_prefixes[i])))
{
langint = i;
found = 1;
@ -909,6 +906,7 @@ static void mysetenv(const char *name, const char *value)
#else
int len = strlen(name) + 1 + strlen(value) + 1;
char *str = malloc(len);
sprintf(str, "%s=%s", name, value);
putenv(str);
#endif
@ -974,7 +972,8 @@ printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
loc = setlocale(LC_MESSAGES, NULL);
#endif
if (strcmp(oldloc, "") != 0 && strcmp(loc, oldloc) != 0) {
if (strcmp(oldloc, "") != 0 && strcmp(loc, oldloc) != 0)
{
/* System doesn't recognize that locale! Hack, per Albert C., is to set LC_ALL to a valid UTF-8 locale, then set LANGUAGE to the locale we want to force -bjk 2010.10.05 */
/* Albert's comments from December 2009:
@ -1003,7 +1002,9 @@ printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
mysetenv("LANGUAGE", oldloc);
set_langint_from_locale_string(oldloc);
} else {
}
else
{
#ifdef _WIN32
if (getenv("LANGUAGE") == NULL)
mysetenv("LANGUAGE", loc);
@ -1015,6 +1016,7 @@ printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
env_language = strdup(getenv("LANGUAGE"));
int j = 0;
char *env_language_lang;
if (*env_language)
{
env_language_lang = strtok(env_language, ":");
@ -1073,9 +1075,7 @@ printf ("Locale AFTER is: %s\n", setlocale(LC_ALL,NULL));//EP
#endif
#ifdef DEBUG
fprintf(stderr, "DEBUG: Language is %s (%d) %s/%s\n",
lang_prefix, langint,
need_right_to_left ? "(RTL)" : "",
need_right_to_left_word ? "(RTL words)" : "");
lang_prefix, langint, need_right_to_left ? "(RTL)" : "", need_right_to_left_word ? "(RTL words)" : "");
fflush(stderr);
#endif

View file

@ -207,6 +207,7 @@ extern w_langs wished_langs[255];
int get_current_language(void);
int setup_i18n(const char *restrict lang, const char *restrict locale) MUST_CHECK;
#ifdef NO_SDLPANGO
int smash_i18n(void) MUST_CHECK;
#endif