1
1
# Lingo.dev Python SDK
2
2
3
+ > 💬 ** [ Join our Discord community] ( https://lingo.dev/go/discord ) ** for support, discussions, and updates!
4
+
3
5
[ ![ PyPI version] ( https://badge.fury.io/py/lingodotdev.svg )] ( https://badge.fury.io/py/lingodotdev )
4
6
[ ![ Python support] ( https://img.shields.io/pypi/pyversions/lingodotdev )] ( https://pypi.org/project/lingodotdev/ )
5
7
[ ![ License] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
@@ -31,10 +33,7 @@ from lingodotdev import LingoDotDevEngine
31
33
32
34
# Initialize the engine
33
35
engine = LingoDotDevEngine({
34
- ' api_key' : ' your-api-key-here' ,
35
- ' api_url' : ' https://engine.lingo.dev' , # Optional, defaults to this URL
36
- ' batch_size' : 25 , # Optional, defaults to 25
37
- ' ideal_batch_item_size' : 250 # Optional, defaults to 250
36
+ ' api_key' : ' your-api-key-here'
38
37
})
39
38
40
39
# Localize a simple text
@@ -82,9 +81,6 @@ engine = LingoDotDevEngine(config)
82
81
** Parameters:**
83
82
- ` config ` (dict): Configuration dictionary with the following options:
84
83
- ` api_key ` (str, required): Your Lingo.dev API key
85
- - ` api_url ` (str, optional): API endpoint URL (default: ` https://engine.lingo.dev ` )
86
- - ` batch_size ` (int, optional): Maximum number of items per batch (default: 25, max: 250)
87
- - ` ideal_batch_item_size ` (int, optional): Target size for batch items (default: 250, max: 2500)
88
84
89
85
#### Methods
90
86
@@ -95,10 +91,9 @@ Localize a single text string.
95
91
** Parameters:**
96
92
- ` text ` (str): The text to localize
97
93
- ` params ` (dict): Localization parameters
98
- - ` source_locale ` (str, optional): Source language code (e.g., 'en')
99
- - ` target_locale ` (str, required): Target language code (e.g., 'es')
100
- - ` fast ` (bool, optional): Enable fast mode for better performance on larger batches
101
- - ` progress_callback ` (callable, optional): Progress callback function
94
+ - ` source_locale ` (str): Source language code (e.g., 'en')
95
+ - ` target_locale ` (str): Target language code (e.g., 'es')
96
+ - ` progress_callback ` (callable): Progress callback function
102
97
103
98
** Returns:** ` str ` - The localized text
104
99
@@ -108,8 +103,7 @@ result = engine.localize_text(
108
103
" Welcome to our application" ,
109
104
{
110
105
' source_locale' : ' en' ,
111
- ' target_locale' : ' es' ,
112
- ' fast' : True
106
+ ' target_locale' : ' es'
113
107
}
114
108
)
115
109
```
@@ -121,7 +115,7 @@ Localize a Python dictionary with string values.
121
115
** Parameters:**
122
116
- ` obj ` (dict): The object to localize
123
117
- ` params ` (dict): Localization parameters (same as ` localize_text ` )
124
- - ` progress_callback ` (callable, optional ): Progress callback function
118
+ - ` progress_callback ` (callable): Progress callback function
125
119
126
120
** Returns:** ` dict ` - The localized object with the same structure
127
121
@@ -151,9 +145,8 @@ Localize a text string to multiple target languages.
151
145
** Parameters:**
152
146
- ` text ` (str): The text to localize
153
147
- ` params ` (dict): Batch localization parameters
154
- - ` source_locale ` (str, required): Source language code
155
- - ` target_locales ` (list, required): List of target language codes
156
- - ` fast ` (bool, optional): Enable fast mode
148
+ - ` source_locale ` (str): Source language code
149
+ - ` target_locales ` (list): List of target language codes
157
150
158
151
** Returns:** ` list ` - List of localized strings in the same order as target_locales
159
152
@@ -163,8 +156,7 @@ results = engine.batch_localize_text(
163
156
" Welcome to our platform" ,
164
157
{
165
158
' source_locale' : ' en' ,
166
- ' target_locales' : [' es' , ' fr' , ' de' , ' it' ],
167
- ' fast' : True
159
+ ' target_locales' : [' es' , ' fr' , ' de' , ' it' ]
168
160
}
169
161
)
170
162
```
@@ -303,23 +295,6 @@ result = engine.localize_object(
303
295
)
304
296
```
305
297
306
- ### Configuration Options
307
-
308
- ``` python
309
- # Optimized for large batches
310
- engine = LingoDotDevEngine({
311
- ' api_key' : ' your-api-key' ,
312
- ' batch_size' : 100 , # Larger batches
313
- ' ideal_batch_item_size' : 1000 # Larger items per batch
314
- })
315
-
316
- # Optimized for small, frequent requests
317
- engine = LingoDotDevEngine({
318
- ' api_key' : ' your-api-key' ,
319
- ' batch_size' : 10 , # Smaller batches
320
- ' ideal_batch_item_size' : 100 # Smaller items per batch
321
- })
322
- ```
323
298
324
299
## Development
325
300
@@ -408,4 +383,8 @@ This project uses automated semantic releases:
408
383
409
384
## Changelog
410
385
411
- See [ CHANGELOG.md] ( CHANGELOG.md ) for a detailed history of changes.
386
+ See [ CHANGELOG.md] ( CHANGELOG.md ) for a detailed history of changes.
387
+
388
+ ---
389
+
390
+ > 💬 ** [ Join our Discord community] ( https://lingo.dev/go/discord ) ** for support, discussions, and updates!
0 commit comments