lingodotdev 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 181b9ff8557660e02e6de8604fddd35d36d42686f0bb97c3fcc499ad0f9fdf07
4
- data.tar.gz: d4f509c82cc4d151cdf42d8cf85f2185d1ae37128f364849c177f3b25a001945
3
+ metadata.gz: 28c83f0fada39ed4eec6b9d0b67917fac54a45fc6d8d11b50389f282f49a322c
4
+ data.tar.gz: bdca77419544b1253dd3aecc752f07a92c3acab361f8693d7069f3d74d247160
5
5
  SHA512:
6
- metadata.gz: aed41259a2967a85e829bfeb2175bb705547fc28a7c5ea60c624df21cd09178e65dac28c6cebdffecb8a1bdfcac5431c81d936b003391a4bf305b4be27594ca0
7
- data.tar.gz: feddedd0259ff5feb889dac5f83db5f03f942d03fcce641f4cf0c79d81cd70df7325f7a14e286001ffd7905ef49d98f8a76a379083895ebb589ad57a576375da
6
+ metadata.gz: 458753b774866b16fd4d960ba5e52bcff42b8c322ea3bab294943590ba0a04a09206182fbffcbf9c0fdd51269c542214a689da47893c9519efc7ee8961b2b730
7
+ data.tar.gz: e002510b545296b9b358713113e86d8f1a6aa08d233c2770b04e89730ad291fa6a77e85f2167cf32d3e3c574da048b6d48a3f08264287f1ce42657ed45a5c728
data/README.md CHANGED
@@ -210,13 +210,12 @@ result = engine.localize_text(
210
210
 
211
211
  ### Reference context
212
212
 
213
- Provide additional context to improve translation accuracy:
213
+ Provide existing translations as reference to improve translation accuracy. The `reference` hash maps locale codes to key-value content objects:
214
214
 
215
215
  ```ruby
216
216
  reference = {
217
- context: 'greeting',
218
- tone: 'formal',
219
- domain: 'business'
217
+ 'es' => { 'greeting' => 'Hola', 'farewell' => 'Adiós' },
218
+ 'fr' => { 'greeting' => 'Bonjour', 'farewell' => 'Au revoir' }
220
219
  }
221
220
 
222
221
  result = engine.localize_text(
@@ -314,7 +313,7 @@ Localizes a string to the target locale.
314
313
  - `text` (String): Text to localize
315
314
  - `target_locale` (String): Target locale code (e.g., 'es', 'fr', 'ja')
316
315
  - `source_locale` (String): Source locale code (e.g., 'en')
317
- - `reference` (Hash, optional): Additional context for translation
316
+ - `reference` (Hash, optional): Existing translations keyed by locale code, e.g. `{ 'es' => { 'key' => 'valor' } }`
318
317
  - `on_progress` (Proc, optional): Progress callback
319
318
  - `concurrent` (Boolean): Enable concurrent processing
320
319
  - `&block`: Alternative progress callback
@@ -342,7 +341,7 @@ Localizes an HTML document while preserving structure and formatting. Handles bo
342
341
  - `html` (String): HTML document string to localize
343
342
  - `target_locale` (String): Target locale code (e.g., 'es', 'fr', 'ja')
344
343
  - `source_locale` (String): Source locale code (e.g., 'en')
345
- - `reference` (Hash, optional): Additional context for translation
344
+ - `reference` (Hash, optional): Existing translations keyed by locale code, e.g. `{ 'es' => { 'key' => 'valor' } }`
346
345
  - `on_progress` (Proc, optional): Progress callback
347
346
  - `concurrent` (Boolean): Enable concurrent processing
348
347
  - `&block`: Alternative progress callback
@@ -3,6 +3,6 @@
3
3
  # Ruby SDK for Lingo.dev localization and translation API.
4
4
  module LingoDotDev
5
5
  # Current version of the LingoDotDev SDK.
6
- VERSION = "0.2.0"
6
+ VERSION = "0.2.1"
7
7
  end
8
8
 
data/lib/lingodotdev.rb CHANGED
@@ -190,7 +190,7 @@ module LingoDotDev
190
190
  # @param target_locale [String] the target locale code (e.g., 'es', 'fr', 'ja')
191
191
  # @param source_locale [String] the source locale code (e.g., 'en')
192
192
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
193
- # @param reference [Hash, nil] additional context for translation (optional)
193
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
194
194
  # @param on_progress [Proc, nil] callback for progress updates (optional)
195
195
  # @param concurrent [Boolean] enable concurrent processing (default: false)
196
196
  #
@@ -237,7 +237,7 @@ module LingoDotDev
237
237
  # @param target_locale [String] the target locale code (e.g., 'es', 'fr', 'ja')
238
238
  # @param source_locale [String] the source locale code (e.g., 'en')
239
239
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
240
- # @param reference [Hash, nil] additional context for translation (optional)
240
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
241
241
  # @param on_progress [Proc, nil] callback for progress updates (optional)
242
242
  # @param concurrent [Boolean] enable concurrent processing (default: false)
243
243
  #
@@ -283,7 +283,7 @@ module LingoDotDev
283
283
  # @param target_locale [String] the target locale code (e.g., 'es', 'fr', 'ja')
284
284
  # @param source_locale [String] the source locale code (e.g., 'en')
285
285
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
286
- # @param reference [Hash, nil] additional context for translation (optional)
286
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
287
287
  # @param on_progress [Proc, nil] callback for progress updates (optional)
288
288
  # @param concurrent [Boolean] enable concurrent processing (default: false)
289
289
  #
@@ -341,7 +341,7 @@ module LingoDotDev
341
341
  # @param target_locale [String] the target locale code (e.g., 'es', 'fr', 'ja')
342
342
  # @param source_locale [String] the source locale code (e.g., 'en')
343
343
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
344
- # @param reference [Hash, nil] additional context for translation (optional)
344
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
345
345
  # @param on_progress [Proc, nil] callback for progress updates (optional)
346
346
  # @param concurrent [Boolean] enable concurrent processing (default: false)
347
347
  #
@@ -514,7 +514,7 @@ module LingoDotDev
514
514
  # @param target_locales [Array<String>] array of target locale codes
515
515
  # @param source_locale [String] the source locale code (e.g., 'en')
516
516
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
517
- # @param reference [Hash, nil] additional context for translation (optional)
517
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
518
518
  # @param concurrent [Boolean] enable concurrent processing (default: false)
519
519
  #
520
520
  # @return [Array<String>] array of localized strings in the same order as target_locales
@@ -565,7 +565,7 @@ module LingoDotDev
565
565
  # @param target_locale [String] the target locale code (e.g., 'es', 'fr', 'ja')
566
566
  # @param source_locale [String] the source locale code (e.g., 'en')
567
567
  # @param fast [Boolean, nil] enable fast mode for quicker results (optional)
568
- # @param reference [Hash, nil] additional context for translation (optional)
568
+ # @param reference [Hash, nil] existing translations keyed by locale code, e.g. { 'es' => { 'key' => 'valor' } } (optional)
569
569
  # @param concurrent [Boolean] enable concurrent processing (default: false)
570
570
  #
571
571
  # @return [Array<Hash>] array of localized Hash objects in the same order as input
@@ -69,7 +69,7 @@ RSpec.describe LingoDotDev::Engine do
69
69
 
70
70
  it 'localizes text with reference context' do
71
71
  engine = described_class.new(api_key: api_key, engine_id: engine_id)
72
- reference = { context: 'greeting' }
72
+ reference = { 'es' => { 'text' => 'Hola' } }
73
73
  result = engine.localize_text(
74
74
  'Hello',
75
75
  target_locale: target_locale,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lingodotdev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Turnbull