I’m using the Element API plugin to retrieve my entries as JSON. It is available under the /api route. For getting entries in a different locale I pass a locale query param and use it inside the ElementQuery.
All works fine so far, BUT when I want to use Craft::t inside of a transformer, I get the translations from the main locale, because this is where my /api namespace lives.
Is it possible to modify the locale that Craft is set to, from inside the Element API plugin?