22/**
33 * PHP SDK for Lingo.dev
44 *
5- * @category Localization
6- * @package Lingodotdev\Sdk
7- * @author Lingo.dev Team <hi@lingo.dev>
8- * @license MIT
9- * @link https://lingo.dev
5+ * @category Localization
6+ * @package Lingodotdev\Sdk
7+ * @author Lingo.dev Team <hi@lingo.dev>
8+ * @license MIT https://opensource.org/licenses/ MIT
9+ * @link https://lingo.dev
1010 */
1111
1212namespace Lingodotdev \Sdk ;
2020 * A powerful localization engine that supports various content types including
2121 * plain text, objects, and chat sequences.
2222 *
23- * @category Localization
24- * @package Lingodotdev\Sdk
25- * @author Lingo.dev Team <hi@lingo.dev>
26- * @license MIT
27- * @link https://lingo.dev
23+ * @category Localization
24+ * @package Lingodotdev\Sdk
25+ * @author Lingo.dev Team <hi@lingo.dev>
26+ * @license MIT https://opensource.org/licenses/ MIT
27+ * @link https://lingo.dev
2828 */
2929class LingoDotDevEngine
3030{
@@ -87,9 +87,9 @@ public function __construct(array $config = [])
8787 /**
8888 * Localize content using the Lingo.dev API
8989 *
90- * @param array $payload The content to be localized
91- * @param array $params Localization parameters including source/target locales and fast mode option
92- * @param callable|null $progressCallback Optional callback function to report progress (0-100)
90+ * @param array $payload The content to be localized
91+ * @param array $params Localization parameters including source/target locales and fast mode option
92+ * @param callable|null $progressCallback Optional callback function to report progress (0-100)
9393 *
9494 * @return array Localized content
9595 * @internal
@@ -130,11 +130,11 @@ protected function localizeRaw(array $payload, array $params, callable $progress
130130 /**
131131 * Localize a single chunk of content
132132 *
133- * @param string|null $sourceLocale Source locale
134- * @param string $targetLocale Target locale
135- * @param array $payload Payload containing the chunk to be localized
136- * @param string $workflowId Workflow ID
137- * @param bool $fast Whether to use fast mode
133+ * @param string|null $sourceLocale Source locale
134+ * @param string $targetLocale Target locale
135+ * @param array $payload Payload containing the chunk to be localized
136+ * @param string $workflowId Workflow ID
137+ * @param bool $fast Whether to use fast mode
138138 *
139139 * @return array Localized chunk
140140 */
@@ -176,7 +176,7 @@ private function _localizeChunk(?string $sourceLocale, string $targetLocale, arr
176176 /**
177177 * Extract payload chunks based on the ideal chunk size
178178 *
179- * @param array $payload The payload to be chunked
179+ * @param array $payload The payload to be chunked
180180 *
181181 * @return array An array of payload chunks
182182 */
@@ -214,7 +214,7 @@ private function _extractPayloadChunks(array $payload): array
214214 /**
215215 * Count words in a record or array
216216 *
217- * @param mixed $payload The payload to count words in
217+ * @param mixed $payload The payload to count words in
218218 *
219219 * @return int The total number of words
220220 */
@@ -252,19 +252,13 @@ private function _createId(): string
252252 /**
253253 * Localize a typical PHP array or object
254254 *
255- * @param array $obj The object to be localized (strings will be extracted and translated)
256- * @param array $params Localization parameters:
257- * - sourceLocale: The
258- * source language code
259- * (e.g., 'en') -
260- * targetLocale: The target
261- * language code (e.g.,
262- * 'es') - fast: Optional
263- * boolean to enable fast
264- * mode (faster but
265- * potentially lower
266- * quality)
267- * @param callable|null $progressCallback Optional callback function to report progress (0-100)
255+ * @param array $obj The object to be localized (strings will be extracted and translated)
256+ * @param array $params Localization parameters:
257+ * - sourceLocale: The source language code (e.g., 'en')
258+ * - targetLocale: The target language code (e.g., 'es')
259+ * - fast: Optional boolean to enable fast mode
260+ * @param callable|null $progressCallback Optional callback function to report progress (0-100)
261+ *
268262 * @return array A new object with the same structure but localized string values
269263 */
270264 public function localizeObject (array $ obj , array $ params , callable $ progressCallback = null ): array
@@ -275,18 +269,13 @@ public function localizeObject(array $obj, array $params, callable $progressCall
275269 /**
276270 * Localize a single text string
277271 *
278- * @param string $text The text string to be localized
279- * @param array $params Localization parameters:
280- * - sourceLocale: The
281- * source language code
282- * (e.g., 'en') -
283- * targetLocale: The target
284- * language code (e.g.,
285- * 'es') - fast: Optional
286- * boolean to enable fast
287- * mode (faster for bigger
288- * batches)
289- * @param callable|null $progressCallback Optional callback function to report progress (0-100)
272+ * @param string $text The text string to be localized
273+ * @param array $params Localization parameters:
274+ * - sourceLocale: The source language code (e.g., 'en')
275+ * - targetLocale: The target language code (e.g., 'es')
276+ * - fast: Optional boolean to enable fast mode
277+ * @param callable|null $progressCallback Optional callback function to report progress (0-100)
278+ *
290279 * @return string The localized text string
291280 */
292281 public function localizeText (string $ text , array $ params , callable $ progressCallback = null ): string
@@ -298,17 +287,12 @@ public function localizeText(string $text, array $params, callable $progressCall
298287 /**
299288 * Localize a text string to multiple target locales
300289 *
301- * @param string $text The text string to be localized
302- * @param array $params Localization parameters:
303- * - sourceLocale: The
304- * source language code
305- * (e.g., 'en') -
306- * targetLocales: An array
307- * of target language codes
308- * (e.g., ['es', 'fr']) -
309- * fast: Optional boolean
310- * to enable fast mode (for
311- * bigger batches)
290+ * @param string $text The text string to be localized
291+ * @param array $params Localization parameters:
292+ * - sourceLocale: The source language code (e.g., 'en')
293+ * - targetLocales: An array of target language codes (e.g., ['es', 'fr'])
294+ * - fast: Optional boolean to enable fast mode
295+ *
312296 * @return array An array of localized text strings
313297 */
314298 public function batchLocalizeText (string $ text , array $ params ): array
@@ -338,19 +322,13 @@ public function batchLocalizeText(string $text, array $params): array
338322 /**
339323 * Localize a chat sequence while preserving speaker names
340324 *
341- * @param array $chat Array of chat messages, each with 'name' and 'text' properties
342- * @param array $params Localization parameters:
343- * - sourceLocale: The
344- * source language code
345- * (e.g., 'en') -
346- * targetLocale: The target
347- * language code (e.g.,
348- * 'es') - fast: Optional
349- * boolean to enable fast
350- * mode (faster but
351- * potentially lower
352- * quality)
353- * @param callable|null $progressCallback Optional callback function to report progress (0-100)
325+ * @param array $chat Array of chat messages, each with 'name' and 'text' properties
326+ * @param array $params Localization parameters:
327+ * - sourceLocale: The source language code (e.g., 'en')
328+ * - targetLocale: The target language code (e.g., 'es')
329+ * - fast: Optional boolean to enable fast mode
330+ * @param callable|null $progressCallback Optional callback function to report progress (0-100)
331+ *
354332 * @return array Array of localized chat messages with preserved structure
355333 */
356334 public function localizeChat (array $ chat , array $ params , callable $ progressCallback = null ): array
@@ -380,8 +358,9 @@ public function localizeChat(array $chat, array $params, callable $progressCallb
380358 /**
381359 * Detect the language of a given text
382360 *
383- * @param string $text The text to analyze
384- * @return string Promise resolving to a locale code (e.g., 'en', 'es', 'fr')
361+ * @param string $text The text to analyze
362+ *
363+ * @return string Locale code (e.g., 'en', 'es', 'fr')
385364 */
386365 public function recognizeLocale (string $ text ): string
387366 {
0 commit comments