Open bmpotter opened 3 years ago
hi @bmpotter , I am interested to pick this issue.
can you assign it to me please?
@mabdh sure
@mabdh You asked what i meant by the 2nd bullet in the description. The method https://github.com/open-horizon/exchange-api/blob/1ea5761cfeb9f6ff85d0e74726aed6e9532c1e6d/src/main/scala/com/horizon/exchangeapi/ApiUtils.scala#L181 needs to be able to know the languages that were requested in the Accept-Language
header. But ExchMsg.translate()
doesn't have access to the Akka client request object, and it is called from way too many places to add a regular parameter to it. So i'm hoping each class/trait that calls it can add an implicit variable for the request.
Once that method has the request available to it, you can see an example of pulling a header out of the Akka request at https://github.com/open-horizon/exchange-api/blob/1ea5761cfeb9f6ff85d0e74726aed6e9532c1e6d/src/main/scala/com/horizon/exchangeapi/AuthenticationSupport.scala#L168 .
BTW, for future discussion, it might be easier to chat on the LF Edge open-horizon-mgmt-hub
channel.
Noted @bmpotter
It is actually quite clear after seeing through the code. I just figured out Akka has a MiscDirective
called selectPreferredLanguage
that might be useful for this use case.
I used to code in Go and clojure and was not really familiar with scala but I think this is the good time to explore more and get used to it.
Sure let me raise further questions om the slack channel.
Hello, I would like to contribute to this issue. I would also appreciate any tips for beggining to contribute, thank you!
Currently environment variable
HZN_EXCHANGE_LANG
orLANG
need to be set when starting the exchange server in order to get messages in a different language. It would be more convenient/flexible if the client could specify what language it wants that 1 response in.Accept-Language
with a value likefr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5
(for details, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language )userLang
accordingly