Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rosetta

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetta

  • 1.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Rosetta

Build Status

Rosetta is a library for Rails that helps you identify the translations that are being used on your app pages. The library adds an expandable menu to each page that shows all phrases being used in the page along with additional info depending on the Repository used.

It is especially useful if you use the OneSky translation service since it gives you direct links to edit the translations on OneSky. This makes it easy for copy writers of your app to see the texts in context and edit the translations.

When using regular translations, it shows the file where translation is so you can more easily find and edit it.

Screenshot

Dependencies

Rosetta requires a Ruby version >= 2.3

Repositories

The phrases menu is different depending on the way you manage your translations. There are currently 2 repositories: Local (default) and OneSky

Local Repository

This is the default repository and shows translations managed manually via YML files. It shows the file where each translation is stored to be able to easily find it.

It requires no further configuration.

OneSky repository

Use this repository if you manage your translations using the OneSky translation service. It adds a link to each translations pointing to the edit page for that text in OneSky.

It requires 2 configuration options:

  • subdomain
  • project_id

Installation

Add this to your Gemfile:

gem 'rosetta', '~> 1.1'

and run the bundle install command.

To generate the initializer file run rails g rosetta:install

Getting Started

1. Enable the library

By default, Rosetta is disabled. You need to explicitly enable it when desired. Usually that will depend on the current user making the request.

To enable it in a per-request basis add a before_action :enable_rosetta to the desired controller and add an if condition if necessary. Example:

before_action :enable_rosetta, if: ->() { current_user.admin? }

2. Render the menu where desired

In order to show the menu with the translations you need to indicate where you want to render it. Usually this will be in your application's layout. Add this at the end of the body of your layours/application.html.erb:

<%= render rosetta_menu %>

Configuration

You can configure the library through the initializer.

Example:

Rosetta.setup do |config|
  # OneSky repository config
  config.repository = Rosetta::Repositories::Onesky.new
  config.repository.project_id = ENV['ONESKY_PROJECT_ID']
  config.repository.subdomain = ENV['ONESKY_SUBDOMAIN']

  # Local repository config
  config.repository = Rosetta::Repositories::Local
end

Development

When first developing, you need to run bundle install.

Run the specs with rspec spec.

Launch the dummy app with rails s.

Credits

marsbased

Rosetta is maintained and funded by MarsBased

The names and logos for MarsBased are trademarks of MarsBased.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 26 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc