How to add query parameters to a CacheableJsonResponse's cache?
Add a cache context for the query parameter to the response:

$cache_metadata = (new CacheableMetadata())-&gt;addCacheContexts(['url.query_args:lang']);
$response-&gt;addCacheableDependency($cache_metadata);




About the second question, when this issue is resolved you can use core REST to deliver translated entities: https://www.drupal.org/node/2135829