{"id":18234134,"url":"https://github.com/bodrovis/fun_translations","last_synced_at":"2026-02-28T13:03:20.963Z","repository":{"id":62463032,"uuid":"560575112","full_name":"bodrovis/fun_translations","owner":"bodrovis","description":"Ruby interface for FunTranslations API.","archived":false,"fork":false,"pushed_at":"2024-07-01T10:01:29.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-19T15:51:45.402Z","etag":null,"topics":["api-client","fun-translations","ruby","ruby-client","ruby-interface","rubygem","translation-providers"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bodrovis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-01T19:50:58.000Z","updated_at":"2024-07-01T10:01:30.000Z","dependencies_parsed_at":"2024-11-04T17:03:55.480Z","dependency_job_id":"b6d778ec-0775-4bee-9c43-77c9f2a2fb92","html_url":"https://github.com/bodrovis/fun_translations","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"3b07240f812caffb868e9403ac4642953d208514"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodrovis%2Ffun_translations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodrovis%2Ffun_translations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodrovis%2Ffun_translations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodrovis%2Ffun_translations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bodrovis","download_url":"https://codeload.github.com/bodrovis/fun_translations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869222,"owners_count":19710485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","fun-translations","ruby","ruby-client","ruby-interface","rubygem","translation-providers"],"created_at":"2024-11-04T17:03:48.834Z","updated_at":"2026-02-27T04:30:18.212Z","avatar_url":"https://github.com/bodrovis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FunTranslations API Ruby interface\n\n![Gem](https://img.shields.io/gem/v/fun_translations)\n![CI](https://github.com/bodrovis/fun_translations/actions/workflows/ci.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/bodrovis/fun_translations/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/fun_translations?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6ec16854cfb5d7e4df17/maintainability)](https://codeclimate.com/github/bodrovis/fun_translations/maintainability)\n![Downloads total](https://img.shields.io/gem/dt/fun_translations)\n\nThis is a Ruby client that enables you to easily perform translations using [FunTranslations API](https://api.funtranslations.com/).\n\n*If would like to learn how this gem was built, please check out [this and subsequent lessons](https://www.youtube.com/watch?v=FEfHExlN6-8) on my YT channel (currently only available in Russian).*\n\n## Prerequisites\n\n[Ruby 2.7+](https://www.ruby-lang.org/en/) and [RubyGems subsystem](https://rubygems.org/) is required.\n\n## Installation\n\nInstall this gem by running:\n\n```\n$ gem install fun_translations\n```\n\nOr add it to your `Gemfile`:\n\n```ruby\ngem 'fun_translations'\n```\n\nAnd run:\n\n```\nbundle install\n```\n\n## Usage\n\nInclude the client in your script:\n\n```ruby\nrequire 'fun_translations'\n```\n\nNext, instantiate the client:\n\n```ruby\nclient = FunTranslations.client\n```\n\nAnd perform translations:\n\n```ruby\ntranslation_yoda = client.translate :yoda, \"Hello, my padawan\"\ntranslation_klingon = client.translate :klingon, \"We are klingons.\"\ntranslation_morse = client.translate 'morse/audio', \"Morse code is dit and dash.\"\n```\n\n### Additional request parameters\n\nIn most cases you will only need to pass the text to translate. However, certain translators (for example, `'morse/audio'`) might require additional params. You can specify these params as a third hash argument:\n\n```ruby\ntranslation_morse = client.translate 'morse/audio', \"Morse code is dit and dash.\", speed: 5, tone: 700\n```\n\n### Translation object\n\nThe `translate` method returns an instance of the `FunTranslations::Translation` class. It responds to the following methods:\n\n* `translated_text` — the actual translation result. Please note that in very rare cases this method will return `nil`, specifically, when you are using `'morse/audio'` translator that returns encoded audio only.\n* `original_text` — your initial (base) text.\n* `translation` — translator that you've chosen.\n\n```ruby\ntranslation_yoda.translated_text # =\u003e 'A planet, master obi wan lost'\ntranslation_yoda.original_text # =\u003e 'Master Obi Wan lost a planet'\ntranslation_yoda.translation # =\u003e 'yoda'\n```\n\nThere are additional methods available only for \"audio\" translators:\n\n* `audio` — returns base64-encoded audio stream.\n* `speed` — audio speed.\n* `tone` — audio tone.\n\n```ruby\ntranslation_morse = client.translate 'morse/audio', \"Morse code is dit and dash.\", speed: 5, tone: 700\n\ntranslation_yoda.audio # =\u003e 'data:audio/wave;base64,UklGRjiBCQBXQVZFZm1...'\ntranslation_yoda.speed # =\u003e '5 WPM'\ntranslation_yoda.tone # =\u003e '700 Hz'\n\n# Please note that the `translation` method returns a hash in this case:\n\ntranslation_yoda.translation['source'] # =\u003e 'english'\ntranslation_yoda.translation['destination'] # =\u003e 'morse audio'\n```\n\n### API token\n\nFunTranslations API has a free pricing plan which does not require registering and obtaining an API key. In other words, you can start using the gem right away. However, please be aware that the free plan allows only 5 requests per hour and 60 requests per day. Therefore, you might want to purchase a paid plan and obtain an API key. Then, simply pass this key when instantiating the client:\n\n```ruby\nclient = FunTranslations.client('123abc')\n```\n\nThen perform translations as usual.\n\n## Running tests\n\nTests are written in RSpec (all HTTP requests are stubbed):\n\n```\nrspec .\n```\n\nObserve test results and coverage.\n\n## Copyright and license\n\nLicensed under the [MIT license](./LICENSE.md).\n\nCopyright (c) 2022 [Ilya Krukowski](http://bodrovis.tech)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodrovis%2Ffun_translations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbodrovis%2Ffun_translations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodrovis%2Ffun_translations/lists"}