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:
137
+
138
+
```php
139
+
// Localize with reference for additional context
140
+
$localizedObject = $engine->localizeObject([
141
+
'greeting' => 'Hello',
142
+
], [
143
+
'sourceLocale' => 'en',
144
+
'targetLocale' => 'es',
145
+
'reference' => [
146
+
'fr' => ['greeting' => 'Bonjour']
147
+
],
148
+
]);
149
+
```
150
+
125
151
### Chat Localization
126
152
127
153
Translate a chat conversation while preserving speaker names:
@@ -184,20 +210,20 @@ Track the progress of a localization operation:
184
210
$engine->localizeText('Hello, world!', [
185
211
'sourceLocale' => 'en',
186
212
'targetLocale' => 'es',
187
-
], function ($progress, $chunk, $processedChunk) {
213
+
], function ($progress) {
188
214
echo "Localization progress: $progress%\n";
189
215
});
190
216
```
191
217
192
218
## Demo App
193
219
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`.
220
+
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 optionally `LINGODOTDEV_ENGINE_ID`), and run `php index.php`.
195
221
196
222
Want to see everything in action?
197
223
198
224
1. Clone this repository or copy the `index.php` from the **demo** below into an empty directory.
199
225
2. Run `composer install` to pull in the SDK.
200
-
3. Populate the `LINGODOTDEV_API_KEY` environment variable with your key.
226
+
3. Populate the `LINGODOTDEV_API_KEY` environment variable (and optionally `LINGODOTDEV_ENGINE_ID`).
201
227
4. Execute the script with `php index.php` and observe the output.
0 commit comments