Tue Mar 14 20:23:53 CET 2000

(Saur)

Added patch from Masahiko Mori <masa@cthulhu.engr.sgi.com>
to improve localization support (I modified the patch somewhat).


SVN revision: 2230
This commit is contained in:
Peter Kjellerstedt 2000-03-14 19:27:33 +00:00
parent 13b24955a9
commit f250c01e99
11 changed files with 1120 additions and 1158 deletions

View File

@ -56,3 +56,10 @@ Sun Dec 26 22:54:57 PST 1999
Added patch from Yukihiro Nakai <nakai@internetsolutions.co.jp>
to add setlocale to dox.c
-----------------------------------------------------------------
Tue Mar 14 20:23:53 CET 2000
(Saur)
Added patch from Masahiko Mori <masa@cthulhu.engr.sgi.com>
to improve localization support (I modified the patch somewhat).

View File

@ -12,7 +12,3 @@ EXTRA_SCRIPTS =
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(edocdatadir)
# Japanese
gzip -d -c < $(srcdir)/MAIN-ja | (cd $(DESTDIR)$(edocdatadir); tar -xmf -)
rm -f $(srcdir)/MAIN-ja

View File

@ -194,7 +194,6 @@ main(int argc, char **argv)
int *page_hist = NULL;
int page_hist_len = 1;
int page_hist_pos = 0;
char *lang;
w = 512;
h = 400;
@ -211,8 +210,6 @@ main(int argc, char **argv)
XSetLocaleModifiers("");
setlocale(LC_ALL, NULL);
lang = setlocale(LC_MESSAGES, NULL);
/* I dont want any internationalisation of my numeric input & output */
setlocale(LC_NUMERIC, "C");
@ -260,15 +257,8 @@ main(int argc, char **argv)
docdir = strdup(argv[i]);
}
s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
s[0] = '\0';
if ( lang != NULL && lang[0] != '\0' )
{
sprintf(s, "%s/%s.%s", docdir, docfile, lang );
if ( !exists(s) )
s[0] = '\0';
}
if ( !s[0] )
sprintf(s, "%s/%s", docdir, docfile );
sprintf(s, "%s/%s", docdir, docfile );
findLocalizedFile(s);
#ifndef __EMX__
f = fopen(s, "r");
@ -426,18 +416,8 @@ main(int argc, char **argv)
exe = &(ll->name[6]);
if (exe[0] != '/')
{
char *lang;
tmp[0] = '\0';
lang = setlocale(LC_MESSAGES, NULL);
if ( lang != NULL && lang[0] != '\0' )
{
sprintf(tmp, "%s/%s.%s", docdir, exe, lang);
if ( !exists(tmp) )
tmp[0] = '\0';
}
if ( !tmp[0] )
sprintf(tmp, "%s/%s", docdir, exe);
sprintf(tmp, "%s/%s", docdir, exe);
findLocalizedFile(tmp);
exe = tmp;
}
p = popen(exe, "r");

View File

@ -225,6 +225,7 @@ char *fileof(char *s);
char *fullfileof(char *s);
char *pathtoexec(char *file);
char *pathtofile(char *file);
int findLocalizedFile(char *fname);
void AddPage(Object * obj);
void AddObject(Object * obj);

View File

@ -669,10 +669,10 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
while (s[i])
{
int len, oldflg=0;
int len, oldflg=1;
len = mblen( s + i, strlen( s + i ) );
len = mblen( s + i, MB_CUR_MAX );
if ( len < 0 ) { i++; continue; }
/* Check multibyte character class */
@ -954,3 +954,42 @@ pathtofile(char *file)
}
return (NULL);
}
int
findLocalizedFile(char *fname)
{
#ifndef __EMX__
char *tmp, *lang, *p[3];
int i;
if (!(lang = setlocale(LC_MESSAGES, NULL)))
return 0;
tmp = strdup(fname);
lang = strdup(lang); /* lang may be in static space, thus it must
* be duplicated before we change it below */
p[0] = lang + strlen(lang);
p[1] = strchr(lang, '.');
p[2] = strchr(lang, '_');
for (i = 0; i < 3; i++)
{
if (p[i] == NULL)
continue;
*p[i] = '\0';
sprintf(fname, "%s.%s", tmp, lang);
if (exists(fname))
{
free(tmp);
free(lang);
return 1;
}
}
strcpy(fname, tmp);
free(tmp);
free(lang);
#endif
return 0;
}

View File

@ -544,16 +544,9 @@ RenderPage(Window win, int page_num, int w, int h)
if (pg->background)
{
char tmp[4096];
char *lang = setlocale(LC_MESSAGES, NULL);
tmp[0] = '\0';
if ( lang != NULL && lang[0] != '\0' )
{
sprintf(tmp, "%s/%s.%s", docdir, pg->background, lang);
if ( !exists(tmp) ) tmp[0] = '\0';
}
if ( !tmp[0] )
sprintf(tmp, "%s/%s", docdir, pg->background);
sprintf(tmp, "%s/%s", docdir, pg->background);
findLocalizedFile(tmp);
im = Imlib_load_image(id, tmp);
if (im)
{
@ -808,7 +801,7 @@ RenderPage(Window win, int page_num, int w, int h)
while (txt_disp[(point + cnt)])
{
len = mblen( txt_disp + point + cnt, strlen(txt_disp) - point - cnt);
len = mblen( txt_disp + point + cnt, MB_CUR_MAX);
if ( len < 0 )
{
cnt++;

View File

@ -72,17 +72,10 @@ TextStateLoadFont(TextState * ts)
ss = strchr(dup, '/');
if (ss)
{
char *lang = setlocale(LC_MESSAGES, NULL);
*ss = ' ';
word(dup, 1, w);
if ( lang != NULL && lang[0] != '\0' )
{
sprintf(s, "%s/%s.%s.ttf", docdir, w, lang);
if ( !exists(s) ) *s = '\0';
}
if ( !*s )
sprintf(s, "%s/%s.ttf", docdir, w);
sprintf(s, "%s/%s.ttf", docdir, w);
findLocalizedFile(s);
word(dup, 2, w);
ts->efont = Efont_load(s, atoi(w));
if (ts->efont)

View File

@ -1074,7 +1074,6 @@ ways for you to change what your (Mandrake) message in ChangeLog shows up as,
as well as an easy entry point for you to add your own indent style
(see %names and %indents hashes)
-------------------------------------------------------------------------------
Wed Sep 1 14:40:22 PDT 1999
@ -1088,13 +1087,11 @@ as well as remembers to display the cvs commit as it happens.
Wed Sep 1 16:09:21 PDT 1999
(Raster)
-------------------------------------------------------------------------------
Wed Sep 1 16:09:47 PDT 1999
(Raster)
-------------------------------------------------------------------------------
Wed Sep 1 16:10:02 PDT 1999
@ -1720,8 +1717,6 @@ Added group borders to BrushedMetal, also made the groups be visualized when
they are switched in one of the groups dialogs. Apparently there's a bug
with imageclasses that use transparency, probably an Imlib issue.
-------------------------------------------------------------------------------
Tue Sep 14 10:53:14 PDT 1999
@ -1747,7 +1742,6 @@ Tue Sep 14 15:34:11 EDT 1999
Don't use the fallback border for group borders.
-------------------------------------------------------------------------------
Tue Sep 14 15:54:25 EDT 1999
@ -1757,7 +1751,6 @@ Ooops, the middle button in the titlebar did raise/lower and show/hide
group borders at the same time. Changed show/hide group borders
to shift-middleclick.
-------------------------------------------------------------------------------
Wed Sep 14 18:52:24 EDT 1999
@ -1765,7 +1758,6 @@ Wed Sep 14 18:52:24 EDT 1999
I hope this fixes the segfault that Technoir reported.
-------------------------------------------------------------------------------
Tue Sep 14 17:06:08 PDT 1999
@ -1832,7 +1824,6 @@ Thu Sep 16 16:33:08 EDT 1999
Don't snapshot group borders.
-------------------------------------------------------------------------------
Thu Sep 16 13:59:43 PDT 1999
@ -1895,7 +1886,6 @@ well, it would HELP if I used XA_STRING on those :)
MOST of the taskbar works now.
still have to do updates of title setting KWM_WIN_TITLE.
-------------------------------------------------------------------------------
Thu Sep 16 18:59:43 PDT 1999
@ -1906,7 +1896,6 @@ segfault.
Needs fixing. BIG bug. if you turn "kde off" in your eesh it will fix that,
or if you want kde support only use desktop 0 for now. 'nuff said.
-------------------------------------------------------------------------------
Fri Sep 17 08:57:02 PDT 1999
@ -2019,7 +2008,6 @@ minor fix that should keep kpanel win_add's from duplicating on map.
(hopefully) - this fixes the desktop change window duplication bugs, too. I
might have some stacking issues to deal with.
-------------------------------------------------------------------------------
Mon Sep 20 11:53:55 PDT 1999
@ -2054,7 +2042,6 @@ added important TODO item for kde support :
mandrake: um, don't use close from the kpanel menu right yet. that's a bad idea. in fact, I wouldn't use ANY of the kpanel windowops things yet. (nasty)
-------------------------------------------------------------------------------
Mon Sep 20 15:20:56 PDT 1999
@ -2078,7 +2065,6 @@ menu.
Added some group issues to TODO file. I hope I get to finish that
during this week.
-------------------------------------------------------------------------------
Mon Sep 20 19:41:17 PDT 1999
@ -2120,7 +2106,6 @@ weren't reset after closing some dialogs.
Tweaked the user name mapping in ecvs so that it works on my
lappy :)
-------------------------------------------------------------------------------
@ -2189,7 +2174,6 @@ the remember dialog not coming up bug.. fixed.. :)
(shoudl restart correctly, exit correcttly, restart anotherwm correctly and
restart themes correctly)
-------------------------------------------------------------------------------
Wed Sep 22 13:39:22 PDT 1999
@ -2269,7 +2253,6 @@ multiple desktops and via the titlebar or the menu,
so group effects are limited to the current desktop
for now.
-------------------------------------------------------------------------------
Thu Sep 23 14:40:50 PDT 1999
@ -2367,7 +2350,6 @@ Fri Sep 24 16:43:48 EST 1999
Grrr. Added more bugs.
-------------------------------------------------------------------------------
Sat Sep 25 13:03:34 PDT 1999
@ -2390,7 +2372,6 @@ Sun Sep 26 19:37:30 PDT 1999
added patch from Martin Tyler <martin@boo.org>
fixes segfaults in modules loading with ipc.
-------------------------------------------------------------------------------
Sun Sep 26 19:45:58 PDT 1999
@ -2447,7 +2428,6 @@ Mon Sep 27 13:31:26 PDT 1999
oops, forgot an EDBUG init in those functions
-------------------------------------------------------------------------------
Mon Sep 27 23:54:54 PDT 1999
@ -2585,7 +2565,6 @@ Thu Sep 30 22:36:37 PDT 1999
added KDE Support config dialog
-------------------------------------------------------------------------------
Thu Sep 30 23:05:53 PDT 1999
@ -2682,7 +2661,6 @@ Fri Oct 1 16:17:41 PDT 1999
I can't reproduce the transparency issue bug.
-------------------------------------------------------------------------------
Fri Oct 1 16:19:08 PDT 1999
@ -2787,7 +2765,6 @@ xmms behavior patches)
Sat Oct 2 17:27:31 PDT 1999
(Raster)
add dialog to explain pagers and iconboxes arent part of a group... :)
-------------------------------------------------------------------------------
@ -3374,7 +3351,6 @@ entry for it. - I've redone a lot of this theme from the ground up. it still
has a ways to go - a little more eterm autotheme tinkering as well as redoing
the epplet config (which I just copied straight from brushed metal)
-------------------------------------------------------------------------------
Sun Oct 10 01:32:17 PDT 1999
@ -3561,7 +3537,6 @@ sed through and use a single reference point to build that at some point)
also fixed some of the EMX stuff
-------------------------------------------------------------------------------
Mon Oct 18 17:42:03 PDT 1999
@ -3639,7 +3614,6 @@ Wed Oct 20 11:38:40 PDT 1999
I broke a small portion of code in OS/2
-------------------------------------------------------------------------------
Wed Oct 20 11:43:14 PDT 1999
@ -3692,7 +3666,6 @@ Wed Oct 20 18:09:59 PDT 1999
updated man pages.
Now it should automatically build from the e/dox/E-docs/MAIN file
-------------------------------------------------------------------------------
Thu Oct 21 11:07:00 PDT 1999
@ -3781,7 +3754,6 @@ Wed Oct 27 15:02:57 EST 1999
New backgrounds for the dialogs, menus and the documentation.
I grew bored with the old ones. Opinions welcome :)
-------------------------------------------------------------------------------
Wed Oct 27 12:36:22 PDT 1999
@ -3820,7 +3792,6 @@ I can't think of why this would be segfaulting or how this code could have
gotten called if there were no border, but I think this must be the segfault
I received in email. *shrug*
-------------------------------------------------------------------------------
Thu Oct 28 13:07:01 PDT 1999
@ -3843,7 +3814,6 @@ Sat Oct 30 12:37:48 PDT 1999
fixed KDE from accidentally closing when we didn't mean to exit.
-------------------------------------------------------------------------------
Wed Nov 3 00:45:47 EST 1999
@ -3854,7 +3824,6 @@ the close button in groups dialogs. Hey who among the
gentlemen around here removed the apply button? He missed
that :)
-------------------------------------------------------------------------------
Fri Nov 5 14:24:02 PST 1999
@ -3864,7 +3833,6 @@ holy crap I can't believe I didn't see that bug sooner.
This should fix the "maximize seems to mess up when I have KDE support
enabled" bug.
-------------------------------------------------------------------------------
Sat Nov 6 10:51:24 PST 1999
@ -3872,7 +3840,6 @@ Sat Nov 6 10:51:24 PST 1999
removed two warnings when compiled with --disable-zoom
-------------------------------------------------------------------------------
Sat Nov 6 11:54:31 PST 1999
@ -3908,7 +3875,6 @@ fix some clipping code for arrage stuff...
Sat Nov 6 15:07:24 PST 1999
(Mandrake)
Fixed a bug in KDE support where windows would place themselves underneath the
kpanel occasionally. it shouldn't ever do that again :)
@ -3920,7 +3886,6 @@ Sat Nov 6 16:09:57 PST 1999
Fixed a bug where selecting a window on another desktop using kpanel wouldn't
change the current desktop in kpanel (workaround for kpanel bug)
-------------------------------------------------------------------------------
Sun Nov 7 18:20:16 PST 1999
@ -4105,7 +4070,6 @@ you can get an extended list using "window_list extended"
returns the following format:
"window_id : title :: desktop : area_x area_y : x_coordinate y_coordinate
-------------------------------------------------------------------------------
Tue Dec 21 22:29:49 PST 1999
@ -4197,7 +4161,6 @@ Fixed issues on platforms with unsigned chars.
Mon Jan 31 10:50:09 PST 2000
(Raster)
text compression works wiht multi-byte stuff now thanks to masahiko :)
-------------------------------------------------------------------------------
@ -4221,7 +4184,6 @@ Default behaviour is not changed, the setting is saved and loaded correctly.
*Clenches and awaits cl00batting*
-------------------------------------------------------------------------------
Sun Feb 20 18:10:30 GMT 2000
@ -4238,7 +4200,6 @@ and gkrellm etc out of it...
Feel free to revert the commit if it's inappropriate...
-------------------------------------------------------------------------------
Mon Feb 21 20:46:52 GMT 2000
@ -4254,7 +4215,6 @@ windows bring up root menus...
Lots of changes, so check for bugs =)
-------------------------------------------------------------------------------
Mon Feb 21 21:48:34 GMT 2000
@ -4262,7 +4222,6 @@ Mon Feb 21 21:48:34 GMT 2000
Warning removal. I was a bad boy.
-------------------------------------------------------------------------------
Mon Feb 21 21:50:20 GMT 2000
@ -4270,7 +4229,6 @@ Mon Feb 21 21:50:20 GMT 2000
and this.
-------------------------------------------------------------------------------
Sun Feb 27 14:55:54 GMT 2000
@ -4291,7 +4249,6 @@ remember windowid sticky command size ...
This streamlines epplets in particular, and speeds up Epplet_remember by a
factor of 8. (Significant on certain boxen).
-------------------------------------------------------------------------------
Sun Feb 27 15:39:37 GMT 2000
@ -4299,7 +4256,6 @@ Sun Feb 27 15:39:37 GMT 2000
*cough*. Now the remember ipc should actually *work*. Sorry ;)
-------------------------------------------------------------------------------
Sun Feb 27 15:54:11 GMT 2000
@ -4307,7 +4263,6 @@ Sun Feb 27 15:54:11 GMT 2000
remove a debugging printf
-------------------------------------------------------------------------------
Mon Feb 28 18:04:33 GMT 2000
@ -4319,7 +4274,6 @@ list options into one winop: "Skip Window Lists", and one remember option.
The actions are still defined to do stuff individually, but users have no
need of that sort of granularity. Much nicer now :)
-------------------------------------------------------------------------------
Mon Feb 28 19:39:46 GMT 2000
@ -4327,7 +4281,6 @@ Mon Feb 28 19:39:46 GMT 2000
64-bit fixes from Bob Arendt <rdarendt@cwcom.net>
-------------------------------------------------------------------------------
Tue Feb 29 19:44:59 GMT 2000
@ -4336,7 +4289,6 @@ Tue Feb 29 19:44:59 GMT 2000
Hehe. Typo stopped the list skip thing being loaded from the .snaps.x file.
Fixed.
-------------------------------------------------------------------------------
Tue Mar 14 18:57:38 CET 2000
@ -4344,3 +4296,11 @@ Tue Mar 14 18:57:38 CET 2000
Small fix for people who want to pop up
menus using their keyboard.
-------------------------------------------------------------------------------
Tue Mar 14 20:23:53 CET 2000
(Saur)
Added patch from Masahiko Mori <masa@cthulhu.engr.sgi.com>
to improve localization support (I modified the patch somewhat).

1943
src/E.h

File diff suppressed because it is too large Load Diff

View File

@ -1168,7 +1168,7 @@ BorderPartLoad(FILE * ConfigFile, char type, Border * b)
int flags = FLAG_BUTTON;
char isregion = 0, keepshade = 1;
int wmin = 0, wmax = 0, hmin = 0, hmax = 0, torigin = 0,
txp = 0, txa = 0, typ = 0, tya = 0, borigin = 0;
txp = 0, txa = 0, typ = 0, tya = 0, borigin = 0;
int bxp = 0, bxa = 0, byp = 0, bya = 0;
int fields;
@ -1395,9 +1395,8 @@ Config_Button(FILE * ConfigFile)
char ontop = 0;
int flags = 0, minw = 1, maxw = 99999, minh = 1;
int maxh = 99999, xo = 0, yo = 0, xa = 0;
int xr = 0, ya = 0, yr = 0, xsr = 0, xsa = 0, ysr = 0, ysa =
0;
int xr = 0, ya = 0, yr = 0;
int xsr = 0, xsa = 0, ysr = 0, ysa = 0;
char simg = 0;
int desk = 0;
char sticky = 0;
@ -1439,7 +1438,7 @@ Config_Button(FILE * ConfigFile)
{
bt = CreateButton(name, ic, ac, tc, label, ontop, flags,
minw, maxw, minh, maxh, xo, yo, xa, xr, ya,
yr, xsr, xsa, ysr, ysa, simg, desk, sticky);
yr, xsr, xsa, ysr, ysa, simg, desk, sticky);
bt->default_show = show;
bt->internal = internal;
AddItem(bt, bt->name, 0, LIST_TYPE_BUTTON);
@ -2235,7 +2234,7 @@ Config_ActionClass(FILE * ConfigFile)
{
action_tooltipstring = Erealloc(action_tooltipstring,
(strlen(action_tooltipstring)
+ strlen(atword(s, 2)) + 2));
+ strlen(atword(s, 2)) + 2));
action_tooltipstring = strcat(action_tooltipstring, "\n");
action_tooltipstring =
strcat(action_tooltipstring, atword(s, 2));
@ -2273,7 +2272,7 @@ Config_ActionClass(FILE * ConfigFile)
RecoverUserConfig();
Alert(_
("Warning: Configuration appears to have ended before we were\n"
"Done loading an Action Class block. Outcome is likely not good.\n"));
"Done loading an Action Class block. Outcome is likely not good.\n"));
}
void
@ -3135,7 +3134,7 @@ Config_WindowMatch(FILE * ConfigFile)
}
}
Alert(_("Warning: Configuration appears to have ended before we were\n"
"Done loading an WindowMatch block. Outcome is likely not good.\n"));
"Done loading an WindowMatch block. Outcome is likely not good.\n"));
}
int
@ -3187,7 +3186,7 @@ OpenConfigFileForReading(char *path, char preprocess)
"Enlightenment is looking for epp here:\n"
"%s\n"
"This is a FATAL ERROR.\n"
"This is probably due to either the program not existing or\n"
"This is probably due to either the program not existing or\n"
"it not being able to be executed by you.\n"), epp_path);
doExit(_("error"));
}
@ -3282,9 +3281,8 @@ int
LoadConfigFile(char *f)
{
FILE *ConfigFile;
char s[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX], *file,
*ppfile;
char s[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX];
char *file, *ppfile;
int i;
char notheme = 0;
@ -3414,7 +3412,7 @@ LoadOpenConfigFile(FILE * ConfigFile)
"Enlightenment's\n"
"it may be that you haven't upgraded "
"Enlightenment for\n"
"a while and this theme takes advantages of new\n"
"a while and this theme takes advantages of new\n"
"features in Enlightenment in new versions.\n"),
e_cfg_ver, min_e_cfg_ver);
RESET_ALERT;
@ -3436,8 +3434,8 @@ LoadOpenConfigFile(FILE * ConfigFile)
"be compatible.\n"
"\n"
"If you just upgraded to a new version of E\n"
"Restarting with Defaults will remove your current\n"
"user preferences and start cleanly with system\n"
"Restarting with Defaults will remove your current\n"
"user preferences and start cleanly with system\n"
"defaults. You can then modify your "
"configuration to\n"
"your liking again safely.\n"),
@ -3528,14 +3526,9 @@ char *
FindFile(char *file)
{
char s[FILEPATH_LEN_MAX];
char *locale = NULL;
EDBUG(6, "FindFile");
#ifndef __EMX__
locale = setlocale(LC_MESSAGES, NULL);
#endif
/* if absolute path - and file exists - return it */
#ifndef __EMX__
if (file[0] == '/')
@ -3543,15 +3536,9 @@ FindFile(char *file)
if (_fnisabs(file))
#endif
{
if (locale)
{
Esnprintf(s, sizeof(s), "%s.%s", file, locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
if (isfile(file))
EDBUG_RETURN(duplicate(file));
strcpy(s, file);
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
}
#ifdef __EMX__
if (file[0] == '/')
@ -3560,43 +3547,28 @@ FindFile(char *file)
EDBUG_RETURN(duplicate(__XOS2RedirRoot(file)));
}
#endif
/* look in ~/.enlightenment first */
if (locale)
{
Esnprintf(s, sizeof(s), "%s/%s.%s", UserEDir(), file, locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
Esnprintf(s, sizeof(s), "%s/%s", UserEDir(), file);
if (isfile(s))
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
/* look in theme dir */
if (locale)
{
Esnprintf(s, sizeof(s), "%s/%s.%s", themepath, file, locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
Esnprintf(s, sizeof(s), "%s/%s", themepath, file);
if (isfile(s))
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
/* look in system config dir */
#ifndef __EMX__
if (locale)
{
Esnprintf(s, sizeof(s), "%s/config/%s.%s", ENLIGHTENMENT_ROOT, file,
locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
Esnprintf(s, sizeof(s), "%s/config/%s", ENLIGHTENMENT_ROOT, file);
#else
Esnprintf(s, sizeof(s), "%s/config/%s",
__XOS2RedirRoot(ENLIGHTENMENT_ROOT), file);
#endif
if (isfile(s))
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
/* not found.... NULL */
EDBUG_RETURN(NULL);
}
@ -3605,14 +3577,9 @@ char *
FindNoThemeFile(char *file)
{
char s[FILEPATH_LEN_MAX];
char *locale = NULL;
EDBUG(6, "FindFile");
#ifndef __EMX__
locale = setlocale(LC_MESSAGES, NULL);
#endif
/* if absolute path - and file exists - return it */
#ifndef __EMX__
if (file[0] == '/')
@ -3620,15 +3587,9 @@ FindNoThemeFile(char *file)
if (_fnisabs(file))
#endif
{
if (locale)
{
Esnprintf(s, sizeof(s), "%s.%s", file, locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
if (isfile(file))
EDBUG_RETURN(duplicate(file));
strcpy(s, file);
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
}
#ifdef __EMX__
if (file[0] == '/')
@ -3637,32 +3598,22 @@ FindNoThemeFile(char *file)
EDBUG_RETURN(duplicate(__XOS2RedirRoot(file)));
}
#endif
/* look in ~/.enlightenment first */
if (locale)
{
Esnprintf(s, sizeof(s), "%s/%s.%s", UserEDir(), file, locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
/* look in ~/.enlightenment first */
Esnprintf(s, sizeof(s), "%s/%s", UserEDir(), file);
if (isfile(s))
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
/* look in system config dir */
#ifndef __EMX__
if (locale)
{
Esnprintf(s, sizeof(s), "%s/config/%s.%s", ENLIGHTENMENT_ROOT, file,
locale);
if (isfile(s))
EDBUG_RETURN(duplicate(s));
}
Esnprintf(s, sizeof(s), "%s/config/%s", ENLIGHTENMENT_ROOT, file);
#else
Esnprintf(s, sizeof(s), "%s/config/%s",
__XOS2RedirRoot(ENLIGHTENMENT_ROOT), file);
#endif
if (isfile(s))
if (findLocalizedFile(s) || isfile(s))
EDBUG_RETURN(duplicate(s));
/* not found.... NULL */
EDBUG_RETURN(NULL);
}
@ -3727,7 +3678,7 @@ LoadEConfig(char *themelocation)
"permissions or lack of disk space. It also could be that the\n"
"config directory has been inadvertently deleted since\n"
"installation.\n"
"This is a serious problem and should be rectified immediately\n"
"This is a serious problem and should be rectified immediately\n"
"Please contact your system administrator or package "
"maintainer.\n"
"If you are the administrator of your own system please\n"
@ -3741,7 +3692,8 @@ LoadEConfig(char *themelocation)
{
Progressbar *p = NULL;
int i;
char *config_files[] = {
char *config_files[] =
{
"init.cfg",
"control.cfg",
"textclasses.cfg",
@ -4208,12 +4160,12 @@ RecoverUserConfig(void)
_("Yes, Attempt recovery"),
_("Restart and try again"), _("Quit and give up"));
Alert(_
("Enlightenment has encountered parsing errors in your autosaved\n"
"configuration.\n" "\n"
"This may be due to filing system errors, Minor bugs or"
" unforeseen\n" "system shutdowns.\n" "\n"
"Do you wish Enlightenment to recover its original system\n"
"configuration and try again?\n"));
("Enlightenment has encountered parsing errors in your autosaved\n"
"configuration.\n" "\n"
"This may be due to filing system errors, Minor bugs or"
" unforeseen\n" "system shutdowns.\n" "\n"
"Do you wish Enlightenment to recover its original system\n"
"configuration and try again?\n"));
RESET_ALERT;
mode.autosave = 0;
MapUnmap(1);

View File

@ -263,7 +263,8 @@ cp(char *s, char *ss)
EDBUG_RETURN_;
}
time_t moddate(char *s)
time_t
moddate(char *s)
{
struct stat st;
@ -1079,3 +1080,42 @@ pathtofile(char *file)
#endif
EDBUG_RETURN(NULL);
}
int
findLocalizedFile(char *fname)
{
#ifndef __EMX__
char *tmp, *lang, *p[3];
int i;
if (!(lang = setlocale(LC_MESSAGES, NULL)))
return 0;
tmp = strdup(fname);
lang = strdup(lang); /* lang may be in static space, thus it must
* be duplicated before we change it below */
p[0] = lang + strlen(lang);
p[1] = strchr(lang, '.');
p[2] = strchr(lang, '_');
for (i = 0; i < 3; i++)
{
if (p[i] == NULL)
continue;
*p[i] = '\0';
sprintf(fname, "%s.%s", tmp, lang);
if (isfile(fname))
{
free(tmp);
free(lang);
return 1;
}
}
strcpy(fname, tmp);
free(tmp);
free(lang);
#endif
return 0;
}