Preserve locale in REST and AJAX requests
REST and AJAX requests do not always carry the visible page path. POM Translate handles only supported routes, methods, actions, and fields unless an integration extends the public allowlists.
REST integration
Use:
pom_translate_rest_route_allowlistto add a route pattern;pom_translate_rest_method_allowlistto permit methods for a route;pom_translate_rest_field_allowlistorpom_translate_json_field_allowlistto identify textual response fields;pom_translate_should_handle_rest_requestfor the final request decision.
AJAX integration
Use:
pom_translate_ajax_action_allowlistto add a public action;pom_translate_ajax_field_allowlistorpom_translate_json_field_allowlistfor textual payload fields;pom_translate_should_handle_ajax_requestfor the final decision.
Pass an explicit enabled locale using the request convention already used by the calling page. Never trust a submitted locale for authorization; validate permissions and nonces independently.
Only allowlist fields that contain public human-readable text. IDs, prices, tokens, HTML selectors, URLs, and control values must not be translated as prose.
Verify JSON shape, status codes, headers, and every allowed field in base and target locales. Translation must not alter keys, numeric values, private data, or REST mutation semantics.