aMule Forum
English => en_Bugs => Topic started by: wuischke on May 14, 2008, 12:30:53 PM
-
I'm currently working on a skin (made by GeVauDan) which uses filenames similar to the following:
themes/backfromspace/css/style.css
themes/base/images/amule/ico_amule_128.png
It will not load the first one at all (<html><title> Error - requested page not found </title></html>) although it exists on the local file system with the same relativ path and I get a curious error in amuleweb log when requesting the second one:
11:23:21: Error: can't open file '/home/johkra/.aMule/webserver/webs/ico_amule_128.png' (error 2: No such file or directory)
CFileImage: failed to open /home/johkra/.aMule/webserver/webs/ico_amule_128.png
It stripped the path for some reason and of course it can't find it then. In this case, it will also hang and not react at all on new requests for the login page and only a restart of amuleweb solves the problem. It didn't hang after login in, although it still would strip the path of the pictures.
Even after successfully login in, the problem persists. Is this expected behaviour and if yes, can this be changed? I use r8500, btw.
So, now back to gettext...
-
I will check both issues. No, this is not the way it's supposed to work.
-
OK, correction, this IS expected behavior. Apparently this was done to prevent access to files beyond template directory (think about .. in path).
// To prevent access to non-template images, we disallow use of paths in filenames.
wxString imgName = wxFileName::GetPathSeparator() + wxFileName(Data.parsedURL.File()).GetFullName();
CAnyImage *img = m_ImageLib.GetImage(imgName);
Now, back to gettext...crash fixed.
-
Thanks gonosztopi
-
You're welcome.
-
I don't know whether it's possible to change language of application without restart, but if it is - interface in php is needed to do it from within webpage.
-
Very true. I did think about it, all you need to do it is to call CaMuleWebInterface::SetLocale() with the desired language code (e.g. "de"). I did not add it to PHP, since I would have needed more time to figure it out where to put it (maybe into php_amule_lib).
One another thing I was thinking of is making amuleweb multisession-safe, but that's another story.
-
php_amule_lib is place for amule_set_language(). Now, what makes you think that amuleweb is not multisession-safe? It's using session ID coming from client cookie, so it's perfectly possible to have multiple clients.
However, from now on, ALL clients will have interface in same language, but I think it's reasonable limitation.
-
However, from now on, ALL clients will have interface in same language.
That's exacly what I meant by multisession-safe, although I choose the wrong expression to express myself.
Ideally all clients could select different language and maybe also template, too.
-
Well, since gettext-style translation done on application level, the only solution would be fork() for each connected client.
-
Or to write the necessary functions for accessing GNU message catalogs.
-
This approach is:
1. Way too complicated
2. Creates unneeded link between webservser session management and language library
-
We don't really need gettext itself, but I would like to use the po/mo format. If you want me to, I'll write a parser for mo files (http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html) which we can integrate into amuleweb. This will solve multi-threading problem and I get to have some fun with C++ again...
-
wuischke: I would have done it already if there weren't ngettext and plural forms. But don't let this disencourage you - have lots of fun with C++ while writing it.
-
NIH syndrome, ah?
-
Good point, I'll save myself some fun and revert to copy, paste and adjust...just like in the eMule modding days...
-
I just stumbled upon this link and need a place to save it... http://number-none.com/blow/code/mo_file/index.html