On Fri, Aug 23, 2019 at 02:18:27PM +0200, Ludovic Courtès wrote: > "pelzflorian (Florian Pelz)" <pelzflor...@pelzflorian.de> skribis: > > On Thu, Aug 22, 2019 at 11:13:53PM +0200, Ludovic Courtès wrote: > >> We should make sure existing URLs are preserved. Do you know if that’s > >> the case? > >> > > > > Preserving URLs requires the above redirects based on the > > Accept-Language HTTP headers. > > So /(.*) should be redirected to /en/\1, right? > > >> Also, I suppose we don’t translate URI paths themselves, right? That’s > >> probably OK, at least as a first version. > >> > > > > I do not understand. > > I mean “guix.gnu.org/en/help” could map to “guix.gnu.org/es/ayuda”, for > instance. That’s not the case, right? > > Thanks, > Ludo’.
Now I understand. Currently the code keeps the URLs and appends the lingua, i.e. I want to keep the URLs as before and then make nginx respond with the file help/index.es_ES.html to a request for guix.gnu.org/help if the HTTP request has a header Accept-Language: es. <a href=…> would not need to be changed in the translation. We could of course translate the URLs instead, we would then add a procedure url->localized-href that calls gettext to return the localized URL for a given URL and replace each (@ (href "/help")) by (@ ,(url->localized-href "/help")) and add --keyword='url->localized-href' to the call to xgettext. The downside is that the logic for nginx would need to look up the translation instead of looking up the locale, that the logic for Haunt would need to look up the filename in the localized builder for pages, and that the translator would need to translate all of "/help", "../help", "../../help" etc. (There needs to be some mapping from the lingua “es” to the locale identifier “es_ES.utf8” in the call to setlocale. Currently the code uses linguas like “es_ES” instead of “es”, which may or may not complicate the logic for nginx, but this could easily be changed.) Regards, Florian