Skip to content

Instantly share code, notes, and snippets.

@edouard
Created December 26, 2017 13:28
Show Gist options
  • Save edouard/b55f733a7e4bec141b41c8af2fa21ad8 to your computer and use it in GitHub Desktop.
Save edouard/b55f733a7e4bec141b41c8af2fa21ad8 to your computer and use it in GitHub Desktop.
Create a plural segment on WebTranslateIt using the API
require "net/http"
require "json"
http = Net::HTTP.new("webtranslateit.com", 443)
http.use_ssl = true
request = Net::HTTP::Post.new("/api/projects/:api_key/strings", {"Content-Type" => "application/json" })
request.body = { "key" => "test_plural", "plural" => true, "translations" => [ { "locale" => "en", "text" => { "one" => "dksjdksjd", "other" => "dksjdskdj"} }] }.to_json
response = http.request(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment