bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26302: Deploying the i18n’d web site


From: Ludovic Courtès
Subject: bug#26302: Deploying the i18n’d web site
Date: Tue, 07 Apr 2020 23:18:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Florian,

"pelzflorian (Florian Pelz)" <address@hidden> skribis:

>> What would it take to complete the i18n’d web site deployment?  It would
>> be great to get that done by the time of the next release.
>>
>
> set_from_accept_language $lang en de;
>
> would better be a global directive.  en comes first so it is the
> default.
>
> Otherwise it’s the changes you quoted.  Testing is difficult though.
> I tested without https and with some modifications to make berlin.scm
> work in a virtual machine.

I had to slightly adjust your changes, leading to the patch below.

I haven’t tested it though.  I’m a bit concerned about the rewrite rule,
because there are bits that should not be rewritten, like:

  /manual (must not be: /LANG/manual, at least for now)
  /guix-refcard.pdf
  …

Will there be rewritten with the config below?

I know you’re already busy with the installer, Florian, so maybe we can
postpone that after the release, unless someone else champions to test it!

Thanks,
Ludo’.

diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm
index 303fd35..7e329fc 100644
--- a/hydra/nginx/berlin.scm
+++ b/hydra/nginx/berlin.scm
@@ -468,6 +468,10 @@ PUBLISH-URL."
     (uri "/guix")
     (body (list "root /var/www;")))
 
+   (nginx-location-configuration
+    (uri "~ (.html|.htm)$")
+    (body (list "try_files /$lang/$uri $uri =404;")))
+
    (nginx-location-configuration                  ;certbot
     (uri "/.well-known")
     (body (list "root /var/www;")))))
@@ -514,6 +518,8 @@ PUBLISH-URL."
     (locations guix.gnu.org-locations)
     (raw-content
      (list
+      "rewrite (.*)/$ $1/index.html;"
+      "set_from_accept_language $lang en de;"
       "access_log /var/log/nginx/guix-info.access.log;")))
 
    (nginx-server-configuration
@@ -525,6 +531,8 @@ PUBLISH-URL."
      (append
       %tls-settings
       (list
+       "rewrite (.*)/$ $1/index.html;"
+       "set_from_accept_language $lang en de;"
        "access_log /var/log/nginx/guix-info.https.access.log;"))))
 
    (nginx-server-configuration
@@ -621,6 +629,8 @@ PUBLISH-URL."
      (append
       %tls-settings
       (list
+       "rewrite (.*)/$ $1/index.html;"
+       "set_from_accept_language $lang en de;"
        "access_log /var/log/nginx/guix-info.https.access.log;"))))
 
    (nginx-server-configuration
@@ -634,6 +644,8 @@ PUBLISH-URL."
      (append
       %tls-settings
       (list
+       "rewrite (.*)/$ $1/index.html;"
+       "set_from_accept_language $lang en de;"
        "access_log /var/log/nginx/guix-gnu-org.https.access.log;"))))
 
    (nginx-server-configuration
@@ -775,6 +787,11 @@ PUBLISH-URL."
 (define %nginx-configuration
   (nginx-configuration
    (server-blocks %berlin-servers)
+   (modules
+    (list
+     ;; Module to redirect users to the localized pages of their choice.
+     (file-append nginx-accept-language-module
+                  "/etc/nginx/modules/ngx_http_accept_language_module.so")))
    (global-directives
     ;; This is a 72-core machine, but let's not use all of them for nginx.
     '((worker_processes . 16)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]