Class: Tolq::Parsers::Xliff::Unparser
- Inherits:
-
Object
- Object
- Tolq::Parsers::Xliff::Unparser
- Defined in:
- lib/xliff/unparser.rb
Overview
Unparses a tolq response to xliff suitable As opposed to other unparsers, requires the original, AND the target language code Assumes single file per xliff
Instance Method Summary collapse
-
#from_hash(translations, original:, target_language_code:) ⇒ String
Unparses a translations hash of key => translation.
-
#from_tolq_response(tolq_response, original:, target_language_code:) ⇒ String
Unparses the tolq response.
Instance Method Details
#from_hash(translations, original:, target_language_code:) ⇒ String
Unparses a translations hash of key => translation
20 21 22 |
# File 'lib/xliff/unparser.rb', line 20 def from_hash(translations, original:, target_language_code:) translate_xliff(translations, original, target_language_code).to_s end |
#from_tolq_response(tolq_response, original:, target_language_code:) ⇒ String
Unparses the tolq response
11 12 13 14 |
# File 'lib/xliff/unparser.rb', line 11 def from_tolq_response(tolq_response, original:, target_language_code:) translations = tolq_response['translations'].values.first translate_xliff(translations, original, target_language_code).to_s end |