دعم لمعاملات tl=[lang] في API؟

In our use case, we are trying to GET localized posts from closed categories in our forum.

It would be a neat addition for the REST API to support ?tl=en as a parameter to pull the translated version of the cooked post.

Currently, the tl param only works for anons.

إعجاب واحد (1)

In general, if you want to find out about the API, the fastest way is to Reverse engineer the Discourse API

إعجاب واحد (1)

This already works for me, for example the current topic with .json?tl=fr gives the right response, notice that cooked is in French:

Ah but if I make a request as a crawler, I get this:

Title is in French but not the posts. This looks like a regression, can you have a look @nat?

إعجابَين (2)

I tried exactly that via /posts/id.json endpoint, but get just the original version in cooked.

Could you check on your end? https://meta.discourse.org/posts/1887991.json?tl=fr

That endpoint works for me, it returns cooked in French. If I switch to tl=es, it returns cooked in Spanish.

Are you calling these endpoints from a specific user? On my end, I am making the requests anonymously.

yep, I do them while logged in. And that’s actually what I am trying to achieve since I want to be able to GET posts from closed categories in our forum.

إعجاب واحد (1)

The tl param only works for anons.

3 إعجابات

Thx for the confirmation! I will edit first post into a feauture request then