New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

i18n_def_scanner

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n_def_scanner

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

I18nDefScanner

Coverage Status

I18nDefScanner is a CLI tool that helps to find where i18n translations defined. It accepts yaml key as argument and returns file path with line number where translation defined.

Motivation

When rails-applications grows it becomes harder to maintain order in your translation files. Is it just one file with thousands of lines or hundreds files and directories it will always take time to find definition of translation you need to update if your code editor not configured to do it. So you can find plugin for your code editor or use this gem. Or configure your code editor to use this gem? :)

Installation

Add this line to your application's Gemfile:

gem 'i18n_def_scanner', require: false

And then execute:

$ bundle

Or install it yourself as:

$ gem install i18n_def_scanner

Usage

All you need is to pass yaml key to executable

bundle exec i18n_def_scanner en.my.deeply.nested.yaml.key

and it will print file path and definition number of line:

config/locales/en.yml:42

Custom locales path

Most of code editors plugins can't analyze rails-application config and consider with custom locales path. As this gem. But this gem has execution options with for locales path:

bundle exec i18n_def_scanner en.my.deeply.nested.yaml.key --path=custom_locales_directory/**/*.yml

As a lib

If you need to locate any yaml definitions in your ruby code you can use this gem as lib, it has:

  1. Simple public API;
  2. No dependencies, using only ruby standard lib;
  3. No monkey patching.

Example of usage:

require 'i18n_def_scanner'

scanning = I18nDefScanner::Scanning.new(query_path: 'some.key',load_path: 'locales/**/*.yml')
puts scanning.result
# locales/filename.yml:42

Compatibility

Ruby 2.6.3

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/GeorgeGorbanev/i18n_def_scanner.

License

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

FAQs

Package last updated on 04 Jul 2020

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