|
| 1 | +/** |
| 2 | + * Render a list (or the full interactive table) of DeepL-supported |
| 3 | + * languages drawn from the vended /v3/languages responses inlined |
| 4 | + * below. The component is sandboxed by Mintlify, so the data has to |
| 5 | + * ship inside this file; see `scripts/fetch_v3_languages.py` for how |
| 6 | + * the `RESOURCES` block is refreshed. |
| 7 | + * |
| 8 | + * Drop the component wherever you would have hand-typed a language |
| 9 | + * list. It must appear at the block level (its own line); MDX does |
| 10 | + * not honour component references mid-paragraph. |
| 11 | + * |
| 12 | + * Props |
| 13 | + * ----- |
| 14 | + * mode: 'inline' (default) | 'bullets' | 'table' |
| 15 | + * - 'inline' - comma-separated `<code>{lang}</code>` list. Use for |
| 16 | + * prose like "supported target languages: `de`, `en`, ..." |
| 17 | + * - 'bullets' - vertical bulleted list of `<code>{lang}</code> ({name})`. |
| 18 | + * Use for API parameter docs where each language has a |
| 19 | + * sub-bullet. |
| 20 | + * - 'table' - the full interactive sortable / filterable table. |
| 21 | + * The `resource`, `feature`, `direction`, and |
| 22 | + * `includeBeta` props are ignored in this mode; the |
| 23 | + * table merges signals across every relevant resource. |
| 24 | + * |
| 25 | + * resource: string (required for 'inline' and 'bullets') |
| 26 | + * Name of the /v3/languages resource to read from. Must match a |
| 27 | + * key in the inlined `RESOURCES` object — i.e. one of |
| 28 | + * `translate_text`, `translate_document`, `voice`, `write`, |
| 29 | + * `glossary`, `style_rules`, or `translation_memory`. When omitted, |
| 30 | + * the component falls back to `translate_text` so the call still |
| 31 | + * renders, but you almost always want to set this explicitly so the |
| 32 | + * list matches the feature you are documenting. |
| 33 | + * |
| 34 | + * feature: string (optional) |
| 35 | + * API feature key to filter by, exactly as it appears in the |
| 36 | + * `features` object of a /v3/languages response (snake_case). Only |
| 37 | + * languages that list this feature in their `features` object are |
| 38 | + * included. Examples by resource: |
| 39 | + * - translate_text / translate_document: 'auto_detection', |
| 40 | + * 'formality', 'glossary', 'style_rules', 'tag_handling' |
| 41 | + * - write: 'auto_detection', 'tone', 'writing_style' |
| 42 | + * - voice: 'auto_detection', 'formality', 'glossary', |
| 43 | + * 'transcription', 'translated_speech' |
| 44 | + * Omit the prop to include every language in the chosen resource. |
| 45 | + * |
| 46 | + * direction: 'source' | 'target' (optional) |
| 47 | + * - 'source' keeps languages with `usable_as_source: true`. |
| 48 | + * - 'target' keeps languages with `usable_as_target: true`. |
| 49 | + * Omit to include both. Use this whenever the feature is |
| 50 | + * directional (e.g. style_rules / writing_style / tone are |
| 51 | + * target-only; auto_detection is source-only). |
| 52 | + * |
| 53 | + * includeBeta: boolean (default false) |
| 54 | + * When true, also include languages whose `status` is not |
| 55 | + * 'stable' (e.g. 'beta' or 'early_access'). The hourly refresh |
| 56 | + * already vends languages and features at every status, so this |
| 57 | + * prop just chooses what to show. |
| 58 | + * |
| 59 | + * Examples |
| 60 | + * -------- |
| 61 | + * <SupportedLanguages mode="table" /> |
| 62 | + * |
| 63 | + * <SupportedLanguages |
| 64 | + * resource="translate_text" |
| 65 | + * feature="style_rules" |
| 66 | + * direction="target" |
| 67 | + * /> |
| 68 | + * |
| 69 | + * <SupportedLanguages |
| 70 | + * mode="bullets" |
| 71 | + * resource="write" |
| 72 | + * feature="writing_style" |
| 73 | + * direction="target" |
| 74 | + * /> |
| 75 | + */ |
1 | 76 | export const SupportedLanguages = ({ |
2 | 77 | mode = 'inline', |
3 | 78 | resource, |
|
0 commit comments