Internationalized webpage depending on the user's web browser locale

40 views
Skip to first unread message

Christoph

unread,
Oct 10, 2022, 12:48:56 PM10/10/22
to golang-nuts
Hello,

I am running a git-server, powered by gitea, an open-source git server project written in Go. In gitea, it is possible to customize the home page, what I did. My customized home page, among other things, contains:

{{if eq .Lang "de-DE"}}
     <h2> Willkommen auf dem Git-Server der Fakultät für Informatik der TU Dortmund</h2>
 {{else}}
      <h2> Welcome to the GIT server of the Faculty of Computer Science of the TU Dortmund</h2>
 {{end}}

This worked with gitea 1.14.5, compiled with some older version of golang, but unfortunately, it does not work in gitea 1.17.2, compiled with golang 1.19.1; the language of the displayed webpage is English, though my browser locale is German.

As far as I found on the internet, the if-else-clause and the .LANG variable come from Go, so I ask here if anyone has an idea of how to make the above work again.

Regards
  Christoph


 

Sean Liao

unread,
Oct 10, 2022, 3:24:51 PM10/10/22
to golang-nuts
.Lang comes from something gitea provided to the template, it's not an intrinsic part of go

- sean

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/ace1198c-d4c4-4208-9bc8-c5db0ae0cb48n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages