You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can pass a reference to provide additional context:
148
+
149
+
```php
150
+
// Localize with reference for additional context
151
+
$localizedObject = $engine->localizeObject([
152
+
'greeting' => 'Hello',
153
+
], [
154
+
'sourceLocale' => 'en',
155
+
'targetLocale' => 'es',
156
+
'reference' => [
157
+
'fr' => ['greeting' => 'Bonjour']
158
+
],
159
+
]);
160
+
```
161
+
125
162
### Chat Localization
126
163
127
164
Translate a chat conversation while preserving speaker names:
@@ -184,20 +221,20 @@ Track the progress of a localization operation:
184
221
$engine->localizeText('Hello, world!', [
185
222
'sourceLocale' => 'en',
186
223
'targetLocale' => 'es',
187
-
], function ($progress, $chunk, $processedChunk) {
224
+
], function ($progress) {
188
225
echo "Localization progress: $progress%\n";
189
226
});
190
227
```
191
228
192
229
## Demo App
193
230
194
-
If you prefer to start with a minimal example instead of the detailed scenarios above, create **index.php** in an empty folder, copy the following snippet, install dependencies with `composer require lingodotdev/sdk`, set `LINGODOTDEV_API_KEY`, and run `php index.php`.
231
+
If you prefer to start with a minimal example instead of the detailed scenarios above, create **index.php** in an empty folder, copy the following snippet, install dependencies with `composer require lingodotdev/sdk`, set `LINGODOTDEV_API_KEY` and `LINGODOTDEV_ENGINE_ID`, and run `php index.php`.
195
232
196
233
Want to see everything in action?
197
234
198
235
1. Clone this repository or copy the `index.php` from the **demo** below into an empty directory.
199
236
2. Run `composer install` to pull in the SDK.
200
-
3. Populate the `LINGODOTDEV_API_KEY`environment variable with your key.
237
+
3. Populate the `LINGODOTDEV_API_KEY`and `LINGODOTDEV_ENGINE_ID` environment variables.
201
238
4. Execute the script with `php index.php` and observe the output.
202
239
203
240
`index.php` demo:
@@ -211,22 +248,21 @@ use LingoDotDev\Sdk\LingoDotDevEngine;
0 commit comments