@@ -50,15 +50,15 @@ public localizeObject(array<string,mixed> $obj, array<string,mixed> $params, nul
5050
5151** Parameters:**
5252
53- | Parameter | Type | Description |
54- | ---------------------| -------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55- | ` $obj ` | ** array<string,mixed>** | Nested data structure containing text to translate |
56- | ` $params ` | ** array<string,mixed>** | Parameters :
53+ | Parameter | Type | Description |
54+ | ---------------------| -------------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55+ | ` $obj ` | ** array<string,mixed>** | Nested data structure containing text to translate |
56+ | ` $params ` | ** array<string,mixed>** | Translation options controlling locale, speed, and contextual reference data :
5757- 'targetLocale' (string, required): Language code to translate into (e.g., 'es', 'fr')
5858- 'sourceLocale' (string\| null): Language code of original text, null for auto-detection
5959- 'fast' (bool): Trade translation quality for speed
60- - 'reference' (array): Context or glossary terms to guide translation |
61- | ` $progressCallback ` | ** null\| callable** | Invoked per batch with (percentage complete, current batch, translated batch) |
60+ - 'reference' (array<string, mixed> \| null ): Context data or glossary terms to guide translation |
61+ | ` $progressCallback ` | ** null\| callable** | Invoked per batch with (percentage complete, current batch, translated batch) |
6262
6363** Return Value:**
6464
@@ -83,15 +83,15 @@ public localizeText(string $text, array<string,mixed> $params, null|callable $pr
8383
8484** Parameters:**
8585
86- | Parameter | Type | Description |
87- | ---------------------| -------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
88- | ` $text ` | ** string** | Text content to translate |
89- | ` $params ` | ** array<string,mixed>** | Parameters :
86+ | Parameter | Type | Description |
87+ | ---------------------| -------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
88+ | ` $text ` | ** string** | Text content to translate |
89+ | ` $params ` | ** array<string,mixed>** | Translation options such as locale hints, speed preference, and contextual references :
9090- 'targetLocale' (string, required): Language code to translate into (e.g., 'es', 'fr')
9191- 'sourceLocale' (string\| null): Language code of original text, null for auto-detection
92- - 'fast' (bool): Prioritize speed over translation quality
93- - 'reference' (array): Context, terminology, or style guidelines for translation |
94- | ` $progressCallback ` | ** null\| callable** | Called with completion percentage (0-100) during processing |
92+ - 'fast' (bool): Trade translation quality for speed
93+ - 'reference' (array<string, mixed> \| null ): Context data or glossary terms to guide translation |
94+ | ` $progressCallback ` | ** null\| callable** | Called with completion percentage (0-100) during processing |
9595
9696** Return Value:**
9797
@@ -116,13 +116,13 @@ public batchLocalizeText(string $text, array<string,mixed> $params): string[]
116116
117117** Parameters:**
118118
119- | Parameter | Type | Description |
120- | -----------| -------------------------| -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
121- | ` $text ` | ** string** | Text content to translate into multiple languages |
122- | ` $params ` | ** array<string,mixed>** | Parameters :
119+ | Parameter | Type | Description |
120+ | -----------| -------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
121+ | ` $text ` | ** string** | Text content to translate into multiple languages |
122+ | ` $params ` | ** array<string,mixed>** | Batch translation options shared by all target locales :
123123- 'sourceLocale' (string, required): Language code of the original text (e.g., 'en')
124124- 'targetLocales' (string[ ] , required): Array of language codes to translate into (e.g., [ 'es', 'fr', 'de'] )
125- - 'fast' (bool): Apply speed optimization to all translations |
125+ - 'fast' (bool): Trade translation quality for speed |
126126
127127** Return Value:**
128128
@@ -142,20 +142,22 @@ When an individual localization request fails
142142Localize a chat transcript while preserving speaker names.
143143
144144``` php
145- public localizeChat(array<int ,array{name: string, text: string} > $chat, array<string ,mixed > $params, null|callable $progressCallback = null): array<int ,array{name: string, text: string} >
145+ public localizeChat(array<int ,array < string,string >> $chat, array<string ,mixed > $params, null|callable $progressCallback = null): array<int ,array < string,string > >
146146```
147147
148148** Parameters:**
149149
150- | Parameter | Type | Description |
151- | ---------------------| --------------------------------------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
152- | ` $chat ` | ** array<int,array{name: string, text: string}>** | Conversation history with speaker names and their messages |
153- | ` $params ` | ** array<string,mixed>** | Parameters:
150+ | Parameter | Type | Description |
151+ | ---------------------| -------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
152+ | ` $chat ` | ** array<int,array<string,string>>** | Conversation history with speaker names and their messages. Each entry must include:
153+ - 'name' (string): Speaker label to preserve
154+ - 'text' (string): Message content to translate |
155+ | ` $params ` | ** array<string,mixed>** | Chat translation options defining locale behavior and context:
154156- 'targetLocale' (string, required): Language code to translate messages into (e.g., 'es', 'fr')
155- - 'sourceLocale' (string\| null): Language of original messages, null for auto-detection
156- - 'fast' (bool): Optimize for speed over translation quality
157- - 'reference' (array): Conversation context or domain-specific terminology |
158- | ` $progressCallback ` | ** null\| callable** | Called with completion percentage (0-100) during processing |
157+ - 'sourceLocale' (string\| null): Language code of original messages, null for auto-detection
158+ - 'fast' (bool): Trade translation quality for speed
159+ - 'reference' (array<string, mixed> \| null ): Context data or glossary terms to guide translation |
160+ | ` $progressCallback ` | ** null\| callable** | Called with completion percentage (0-100) during processing |
159161
160162** Return Value:**
161163
0 commit comments