Skip to content

Instantly share code, notes, and snippets.

@edouard
Created December 27, 2017 09:11
Show Gist options
  • Save edouard/e15a951a3477f9a07f851889b7b15e85 to your computer and use it in GitHub Desktop.
Save edouard/e15a951a3477f9a07f851889b7b15e85 to your computer and use it in GitHub Desktop.
Create a translation on WebTranslateIt using the create Translation endpoint
require "net/http"
require "json"
http = Net::HTTP.new("webtranslateit.com", 443)
http.use_ssl = true
request = Net::HTTP::Post.new("/api/projects/proj_pvt_wL2h87YRMpKLXa8OYdnXAw/strings/15452121/locales/en/translations", {"Content-Type" => "application/json" })
request.body = { "text" => { "one" => "one text", "other" => "other text"} }.to_json
response = http.request(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment