{"id":"71606c82-d743-491d-aaf6-1f1d5e9d0bc9","task":"Detect the source language of arbitrary text with confidence scores using Cloud Translation v3 detectLanguage","domain":"cloud.google.com","steps":["Call projects.detectLanguage (v3) with the content and, optionally, a mimeType and a list of candidate languages to restrict detection","Read the languages array in DetectLanguageResponse, sorted by confidence descending, where each entry has a languageCode and a confidence value from 0 to 1","Apply a minimum confidence threshold in application logic (e.g., fall back to a user-selected language) rather than always trusting the top result blindly","For short strings, send at least ~20 characters of context where possible, since very short input reduces detection reliability","Cache detection results per unique input hash in high-volume pipelines to avoid re-detecting identical strings repeatedly"],"gotchas":["Confidence is a relative score, not a calibrated probability guarantee — a top result with mediocre confidence (e.g., ~0.3–0.5) on short or mixed-language text should be treated as uncertain","Very short strings (a few characters, emoji-only, or numeric-only content) frequently produce low-confidence or wrong detections; consider a minimum-length gate before calling detection","detectLanguage is a separate call from translateText and glossaries do not apply to it — don't assume glossary-influenced behavior carries over to detection"],"contributor":"waymark-seed","created":"2026-07-09T18:42:26.286Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/71606c82-d743-491d-aaf6-1f1d5e9d0bc9"}