Skip to content
/ tagger Public
forked from ujwal-patil/tagger

The Gem is useful for calculating delta between two JSON / YML files, created for locale translations purpose in rails application.

License

Notifications You must be signed in to change notification settings

promobi/tagger

 
 

Repository files navigation

Tagger

Installation

Add this line to your application's Gemfile:

gem 'tagger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tagger

Usage

Tagger is useful for calculating delta diff between json or yml files, and it is basically useful to manage translations string for localization purpose. When your application grow, simulteniously your language strings file size also increases, and then it will become a pain for Maintainers or Owners. For that reason I have introduced this basic diff calculator on temp basis.

To configure for your managed locale JSON or YAML files, continue following steps

  1. Setup Configuration instances for your application in following generated file
   config/initializers/tagger.rb 
Tagger.setup do |config|

  config.parent_controller = 'ApplicationController'
  # Configure git Branch where you want to push your state of application after updating.
  config.git_branch = ENV['LOCALIZER_BRANCH']

  config.instance(:user) do |user_dashboard|
    # file_directory_path - Where your locale json files are located
    user_dashboard.file_directory_path = Rails.root.join('app/assets/javascripts/dashboard-v2/locale')

    # file type like json, yaml etc.
    user_dashboard.file_type = :json

    # keep_recent_tags - This will keep only 3 recent tag versions
    user_dashboard.keep_recent_tags = 3

    # keep_recent_releases - will keep 3 recent releases of each locale root file
    # in /releases/ directory relative to specified source_directory_path.
    user_dashboard.keep_recent_releases = 3

    # once you upload file, all invalid unnecessary files in source_directory_path will be deleted.
    # If you wants to prevent files from source dir, add name of file in ignore_source_directory_files array
    user_dashboard.ignore_source_directory_files = %w()
  end

  config.instance(:reseller) do |reseller_dashboard|
    # file_directory_path - Where your locale json files are located
    reseller_dashboard.file_directory_path = Rails.root.join('app/assets/javascripts/reseller-dashboard/locale')

    # file type like json, yaml etc.
    reseller_dashboard.file_type = :json

    # keep_recent_tags - This will keep only 3 recent tag versions
    reseller_dashboard.keep_recent_tags = 3

    # keep_recent_releases - will keep 3 recent releases of each locale root file
    # in /releases/ directory relative to specified source_directory_path.
    reseller_dashboard.keep_recent_releases = 3

    # once you upload file, all invalid unnecessary files in source_directory_path will be deleted.
    # If you wants to prevent files from source dir, add name of file in ignore_source_directory_files array
    reseller_dashboard.ignore_source_directory_files = %w()
  end

  config.instance(:server) do |server|
    # file_directory_path - Where your locale json files are located
    server.file_directory_path = Rails.root.join('config/locales')

    # file type like json, yaml etc.
    server.file_type = :yml

    # keep_recent_tags - This will keep only 10 recent tag versions
    server.keep_recent_tags = 3

    # keep_recent_releases - will keep 3 recent releases of each locale root file
    # in /releases/ directory relative to specified source_directory_path.
    server.keep_recent_releases = 3

    # once you upload file, all invalid unnecessary files in source_directory_path will be deleted.
    # If you wants to prevent files from source dir, add name of file in ignore_source_directory_files array
    server.ignore_source_directory_files = %w(time-ago)
  end
end
  1. Once done, restart your server
  2. Create your project user who is responsible to update/access the strings using portal
   rails tagger:create <email>
  1. Login to your application using the same username
  2. Navigate the following URL to access the tagger portal
  <BASE_URL>/tagger 
  1. You can use the available portal to Download -> Translate the english delta -> Upload the translated file again to update translated strings image

About

The Gem is useful for calculating delta between two JSON / YML files, created for locale translations purpose in rails application.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 69.4%
  • HTML 22.9%
  • JavaScript 6.5%
  • Other 1.2%