doc/send-translations.rb
# If real, use POST to segment id's translation to new_value
# Return true iff sucessful
If real, use POST to segment id's translation to new_value
Return true iff sucessful
If real use POST to segment id ' s translation to new_value Return true iff sucessful
def post_translation(key, lang, source, new_value)
  return true unless $REAL
  new_value_json = {
    'target_language' => lang,
    'type' => 'key',
    'key' => key,
    'source' => source,
    'target' => new_value
  }.to_json
  IO.popen(
    [
      'curl', '-i',
      '-H', "x-api-key: #{$API_KEY}",
      '-H', 'content-type: application/json',
      '--request', 'POST',
      'https://translation.io/api/v1/segments.json',
      '--data', new_value_json
    ]
  ) do |io|
    curl_output = io.read
    puts curl_output 
    io.close
    $CHILD_STATUS.success? 
  end
end
def post_translation ( key , lang , source , new_value ) return true unless $REAL new_value_json = { 'target_language' => lang , 'type' => 'key' , 'key' => key , 'source' => source , 'target' => new_value } . to_json IO . popen ( [ 'curl' , '-i' , '-H' , "x-api-key: #{$API_KEY}" , '-H' , 'content-type: application/json' , '--request' , 'POST' , 'https://translation.io/api/v1/segments.json' , '--data' , new_value_json ] ) do | io | curl_output = io . read puts curl_output io . close $CHILD_STATUS . success? end end
If real, use POST to segment id's translation to new_value
Return true iff sucessful
If real use POST to segment id ' s translation to new_value Return true iff sucessful
# Note: This popen invocation does NOT go through the shell, # so we do not use shell escapes. # POST https://translation.io/api/v1/segments(.json) # Very useful for debugging! # Return whether or not we succeeded
key
<not_specific>
lang
<not_specific>
source
<not_specific>
new_value
<not_specific>