Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/08c275ed2c843441aad23d38646083de7a130753
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/08c275ed2c843441aad23d38646083de7a130753
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/08c275ed2c843441aad23d38646083de7a130753

The branch, master has been updated
       via  08c275ed2c843441aad23d38646083de7a130753 (commit)
      from  790d30b7888d5818a4e2521aabe2f31f04d59341 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=08c275ed2c843441aad23d38646083de7a130753
commit 08c275ed2c843441aad23d38646083de7a130753
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>

    RISC OS: translate resource paths.
    
    Fixes #2266.

diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index cfc513f..be1bc8d 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -195,6 +195,7 @@ static struct
 static nsurl *gui_get_resource_url(const char *path)
 {
        static const char base_url[] = "file:///NetSurf:/Resources/";
+       const char *lang;
        size_t path_len, length;
        char *raw;
        nsurl *url = NULL;
@@ -220,8 +221,12 @@ static nsurl *gui_get_resource_url(const char *path)
 
        path_len = strlen(path);
 
+       lang = ro_gui_default_language();
+
        /* Find max URL length */
-       length = SLEN(base_url) + SLEN("xx/") + path_len + 1;
+       length = SLEN(base_url) +
+                       strlen(lang) + 1 + /* <lang> + / */
+                       path_len + 1; /* + NUL */
 
        raw = malloc(length);
        if (raw != NULL) {
@@ -230,13 +235,11 @@ static nsurl *gui_get_resource_url(const char *path)
                ptr += SLEN(base_url);
 
                /* Add language directory to URL, for translated files */
-               /* TODO: handle non-en langauages
-                *       handle non-html translated files */
+               /* TODO: handle non-html translated files */
                if (path_len > SLEN(".html") &&
                                strncmp(path + path_len - SLEN(".html"),
                                        ".html", SLEN(".html")) == 0) {
-                       memcpy(ptr, "en/", SLEN("en/"));
-                       ptr += SLEN("en/");
+                       ptr += sprintf(ptr, "%s/", lang);
                }
 
                /* Add filename to URL */


-----------------------------------------------------------------------

Summary of changes:
 frontends/riscos/gui.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index cfc513f..be1bc8d 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -195,6 +195,7 @@ static struct
 static nsurl *gui_get_resource_url(const char *path)
 {
        static const char base_url[] = "file:///NetSurf:/Resources/";
+       const char *lang;
        size_t path_len, length;
        char *raw;
        nsurl *url = NULL;
@@ -220,8 +221,12 @@ static nsurl *gui_get_resource_url(const char *path)
 
        path_len = strlen(path);
 
+       lang = ro_gui_default_language();
+
        /* Find max URL length */
-       length = SLEN(base_url) + SLEN("xx/") + path_len + 1;
+       length = SLEN(base_url) +
+                       strlen(lang) + 1 + /* <lang> + / */
+                       path_len + 1; /* + NUL */
 
        raw = malloc(length);
        if (raw != NULL) {
@@ -230,13 +235,11 @@ static nsurl *gui_get_resource_url(const char *path)
                ptr += SLEN(base_url);
 
                /* Add language directory to URL, for translated files */
-               /* TODO: handle non-en langauages
-                *       handle non-html translated files */
+               /* TODO: handle non-html translated files */
                if (path_len > SLEN(".html") &&
                                strncmp(path + path_len - SLEN(".html"),
                                        ".html", SLEN(".html")) == 0) {
-                       memcpy(ptr, "en/", SLEN("en/"));
-                       ptr += SLEN("en/");
+                       ptr += sprintf(ptr, "%s/", lang);
                }
 
                /* Add filename to URL */


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to