{"id":22831519,"url":"https://github.com/phrase/phraseapp-in-context-editor-ruby","last_synced_at":"2025-04-23T19:43:07.758Z","repository":{"id":33824967,"uuid":"37522306","full_name":"phrase/phraseapp-in-context-editor-ruby","owner":"phrase","description":"Phrase In-Context-Editor for use with Ruby/Rails applications","archived":false,"fork":false,"pushed_at":"2025-03-25T14:48:21.000Z","size":388,"stargazers_count":7,"open_issues_count":8,"forks_count":11,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-25T15:41:46.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://phrase.com","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/phrase.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-16T09:59:09.000Z","updated_at":"2025-03-25T14:36:50.000Z","dependencies_parsed_at":"2023-12-05T17:28:36.057Z","dependency_job_id":"70ab3e5d-88b3-4780-be9c-b046b0dede89","html_url":"https://github.com/phrase/phraseapp-in-context-editor-ruby","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphraseapp-in-context-editor-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphraseapp-in-context-editor-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphraseapp-in-context-editor-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphraseapp-in-context-editor-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phrase","download_url":"https://codeload.github.com/phrase/phraseapp-in-context-editor-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250501332,"owners_count":21441004,"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":[],"created_at":"2024-12-12T20:26:24.331Z","updated_at":"2025-04-23T19:43:07.701Z","avatar_url":"https://github.com/phrase.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# phraseapp-in-context-editor-ruby\n\n![Build status](https://github.com/phrase/phraseapp-in-context-editor-ruby/workflows/Test/badge.svg)\n\n**phraseapp-in-context-editor-ruby** is the official library for integrating [Phrase Strings In-Context Editor](https://support.phrase.com/hc/en-us/articles/5784095916188-In-Context-Editor-Strings) with [i18n](https://github.com/ruby-i18n/i18n) in your Ruby application.\n\n## :scroll: Documentation\n\n### Prerequisites\n\nTo use phraseapp-in-context-editor-ruby with your application you have to:\n\n- Sign up for a Phrase account: [https://app.phrase.com/signup](https://app.phrase.com/signup)\n- Use the excellent [i18n](https://github.com/ruby-i18n/i18n) gem also used by [Rails](https://guides.rubyonrails.org/i18n.html)\n\n### Demo\n\nYou can find a demo project in the `examples/demo` folder, just run `bundle \u0026\u0026 rails s` and head to `http://127.0.0.1:3000`\nLogin via the demo credentials `demo@phrase.com` / `phrase`\n\n### Installation\n\n#### NOTE: You can not use the old version of the ICE with integration versions of \u003e2.0.0, you have to instead use 1.x.x versions as before\n\n#### via Gem\n\n```bash\ngem install phraseapp-in-context-editor-ruby\n```\n\n#### via Bundler\n\nAdd it to your `Gemfile`\n\n```\ngem 'phraseapp-in-context-editor-ruby\n```\n\n#### Build from source\n\nYou can also build it directly from source to get the latest and greatest:\n\n```bash\nbundle \u0026\u0026 gem build\n```\n\n#### Initialized config file\n\nCreate the initializer file by executing the Rails generator:\n\n```bash\nrails generate phraseapp_in_context_editor:install --account_id=\u003cYOUR_ACCOUNT_ID\u003e --project-id=\u003cYOUR_PROJECT_ID\u003e\n```\n\n### Development\n\n```bash\n# install deps\nbundle\n```\n\n#### Configure\n\nAdd the following Ruby snippet to your rails `app/views//layouts/application.html.erb`\n\n```\n\u003c%= load_in_context_editor %\u003e\n```\n\nAnd the following config to your `/config/initializers/phraseapp_in_context_editor.rb`\n\n```ruby\n  config.enabled = true\n  config.project_id = \"YOUR_PROJECT_ID\"\n  config.account_id = \"YOUR_ACCOUNT_ID\"\n  config.datacenter = \"eu\"\n```\n\nYou can find the Project-ID in the Project overview in the PhraseApp Translation Center.\nYou can find the Account-ID in the Organization page in the PhraseApp Translation Center.\n\nIf this does not work for you, you can also integrate the [JavaScript snippet manually](https://help.phrase.com/help/integrate-in-context-editor-into-any-web-framework).\n\nOld version of the ICE is not available since version 2.0.0. If you still would rather use the old version, please go back to 1.x.x versions.\n\n#### Using the US Datacenter with ICE\n\nIn addition to the settings in your `config/initializers/phraseapp_in_context_editor.rb`, set the US datacenter to enable the ICE to work with the US endpoints.\n\n```ruby\n  config.enabled = true\n  config.project_id = \"YOUR_PROJECT_ID\"\n  config.account_id = \"YOUR_ACCOUNT_ID\"\n  config.datacenter = \"us\"\n```\n\n#### Using with CSP\n\nThe script will automatically get the nonce from `content_security_policy_nonce`\nThe content_security_policy.rb has to have `:strict_dynamic` for `policy.script_src` since we are loading more scripts dynamically because of our way of deploying\n\n```ruby\n  policy.script_src :self, :https, :strict_dynamic\n  policy.style_src :self, :https\n```\n\nThe `config.content_security_policy_nonce_directives = %w[script-src style-src]` can include `style-src` but this _might_ break some styling in some cases\n\n### Browser support\n\nThis library might not work out of the box for some older browser or IE11. We recommend to add [Babel](https://github.com/babel/babel) to the build pipeline if those browser need to be supported.\n\n### How does it work\n\nThe library adds custom functionality to the `i18n` package. When `config.enabled = true` this gem modifies the outcoming values from translation functions to present a format which the ICE can read.\n\n### Test\n\nRun unit tests using jest:\n\n```bash\nrspec\n```\n\n## :white_check_mark: Commits \u0026 Pull Requests\n\nWe welcome anyone who wants to contribute to our codebase, so if you notice something, feel free to open a Pull Request! However, we ask that you please use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for your commit messages and titles when opening a Pull Request.\n\nExample: `chore: Update README`\n\n## :question: Issues, Questions, Support\n\nPlease use [GitHub issues](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues) to share your problem, and we will do our best to answer any questions or to support you in finding a solution.\n\n## :memo: Changelog\n\nDetailed changes for each release are documented in the [changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/releases).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrase%2Fphraseapp-in-context-editor-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphrase%2Fphraseapp-in-context-editor-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrase%2Fphraseapp-in-context-editor-ruby/lists"}