[enh] Retrieve and set locale in the api