diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-03-15 23:23:27 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-03-15 23:23:27 +0000 |
commit | ffc8d17a0f4fabc26b45486dbf195015e9fcf76e (patch) | |
tree | 45008ec382af68cf48d0183ff711802142192c64 /riscos | |
parent | 1da7b161f8eb8e2afbb46e9e2904dc3973fc2458 (diff) | |
download | netsurf-ffc8d17a0f4fabc26b45486dbf195015e9fcf76e.tar.gz netsurf-ffc8d17a0f4fabc26b45486dbf195015e9fcf76e.tar.bz2 |
Simple language directory handling.
svn path=/trunk/netsurf/; revision=12069
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/gui.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/riscos/gui.c b/riscos/gui.c index cb3a9504a..6d197e3fe 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -283,15 +283,26 @@ static void ro_gui_view_source_bounce(wimp_message *message); char* gui_find_resource(const char *filename) { - /* TODO: handle language directories */ - size_t length = strlen(filename) + - SLEN("file:///NetSurf:/Resources/") + 1; + /* Find max URL length */ + size_t length = SLEN("file:///NetSurf:/Resources/") + SLEN("xx/") + + strlen(filename) + 1; + /* Allocate memory for URL (freed by the core) */ char *resource_url = malloc(length); if (resource_url == NULL) return NULL; + /* Insert base URL */ resource_url = strcpy(resource_url, "file:///NetSurf:/Resources/"); + + /* Add language directory to URL, for translated files */ + /* TODO: handle non-en langauages + * handle non-html translated files */ + if (strncmp(filename + strlen(filename) - 5, ".html", 5) == 0) { + resource_url = strcat(resource_url, "en/"); + } + + /* Add filename to URL */ return strcat(resource_url, filename); } |