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