diff options
Diffstat (limited to 'api/text.md')
| -rw-r--r-- | api/text.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/api/text.md b/api/text.md index 0d50ee24..22f08242 100644 --- a/api/text.md +++ b/api/text.md @@ -787,7 +787,7 @@ last | `Int` | The index of the last grapheme cluster to include (1-indexed). | ## Text.translate ```tomo -Text.translate : func(text: Text, translations: {Text=Text} -> Text) +Text.translate : func(text: Text, translations: {Text:Text} -> Text) ``` Takes a table mapping target texts to their replacements and performs all the replacements in the table on the whole text. At each position, the first matching replacement is applied and the matching moves on to *after* the replacement text, so replacement text is not recursively modified. See Text.replace() for more information about replacement behavior. @@ -795,7 +795,7 @@ Takes a table mapping target texts to their replacements and performs all the re Argument | Type | Description | Default ---------|------|-------------|--------- text | `Text` | The text to be translated. | - -translations | `{Text=Text}` | A table mapping from target text to its replacement. | - +translations | `{Text:Text}` | A table mapping from target text to its replacement. | - **Return:** The text with all occurrences of the targets replaced with their corresponding replacement text. @@ -803,11 +803,11 @@ translations | `{Text=Text}` | A table mapping from target text to its replaceme **Example:** ```tomo >> "A <tag> & an amperand".translate({ - "&" = "&", - "<" = "<", - ">" = ">", - '"" = """, - "'" = "'", + "&": "&", + "<": "<", + ">": ">", + '"": """, + "'": "'", }) = "A <tag> & an ampersand" |
