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

translations_sync

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

translations_sync

  • 0.4.14
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

TranslationsSync

This gem is intended to help the developer to synchronize the different locales for the project that uses yaml based locales, in particular, I18n.

Requirements

gem 'ya2yaml'
gem 'active_support'

Installation

  1. Add to your Gemfile

    gem 'translations_sync'

  2. If you are using the gem without bundle just install it

    gem install translations_sync

Description

This gem allows different organizations of translation files. They can be grouped in the directories that correspond to locales, or the locale may be defined in the suffix of a file name separated by a dot or underscore. Let us call the file name without locale suffix and extension as base name

When a file name is to be given as parameter in the description below it should not include nor locale prefix, nor locale suffix and extension whichever organization is used.

The main goal of the gem to assist in managing the translations for the project. This can be done by using the rake tasks described below.

The following parameters can be given:

  • LIST=comma,separated,list specifies the locales that should participate in synchronization. For example, LIST=en,de,fr,zh-CN If omitted, I18n.available_locales will be used. The order of the locales is important as the existing for the first locale in the list will be provided for a missing translation(s). The locale in LIST must not be present in I18n.available_locales. This allows easily to add new locales to the project.
  • EXCLUDE=comma,separated,list specifies the locales that should NOT participate.
  • NAME=name. By default missing translations are written to the base name "missing". This parameter tells to use the given name as base name. If any of the corresponding files exist, the missing translations will be added to them.
  • SOURCE=name. Only files with the given base name will be considered.
  • GEMS=list. When SOURCE is in effect additionally the translations from the listed gems will be included.
  • IN=name. It is equivalent to NAME=name SOURCE=name
  • KEY=path.to.key. Points to the key to be moved or removed. Obviously, it should not include locale.
  • TO=path.to.key.

Rake tasks

rake translations:sync

This task verifies that all the translation keys are present in all files specifed by the given parameters and if any is missing creates/updates corresponding file(s).

rake translations:singles

This task generates a single file config/locales/singles.yml that contains the translations occurring only in one locale.

rake translations:move KEY=key.to.move TO=where.to.move

This task moves the content of given KEY under the TO. You can use all the parameters available for the translations:sync task with the default value for the NAME equal to 'moved'.

rake translations:remove KEY=key.to.remove

This task removes the key from the translations. NAME defaults to 'removed' here.

Copyright (c) 2010-2016 Dmitri Koulikoff, released under the MIT license

FAQs

Package last updated on 23 May 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