AppLocale

Public
AppLocale.dev is an app that helps you manage your Ruby on Rails translations.
Icons/chart bar
Used 24 times
â€ĸ Created by
A Andrea Fomera

Usage
Sign up for an account at https://applocale.dev

Check out the gem: https://github.com/applocale/applocale-ruby

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/X8Bsjj"
Template Source

Review the code before running this template on your machine.

run "spring stop"

puts "👋 Welcome to AppLocale's installation process"

puts ""
puts "ℹī¸   You'll need to open up https://applocale.dev in your browser."
puts "     - Login"
puts "     - Click the avatar and open the dropdown"
puts "     - Click API Tokens"
puts "     - Create a new API Token"

puts " "
puts "ℹī¸  If you don't yet have a project, make sure you create one and setup your languages first!"
puts ""

puts "🙌 Okay next up we'll ask for the API Token, and Project ID which you can find on the API Tokens page."

puts ""

api_token = ask("What is your AppLocale API Token?")
project_id = ask("What is your Project ID?")
puts ""

puts "🙌 Great! Thanks for that. We'll go ahead and install the applocale-ruby gem in the development group."

run "bundle add applocale-ruby -g development"

puts ""
puts ""
puts "✅ Installed applocale-ruby"

puts "✨ Now we're going to generate your configuration file. We're putting it inside of config/applocale.yml"

config_file = <<-CONFIG
# AppLocale.dev configuration file
applocale:
  api_key: #{api_token}
  project_id: #{project_id}
CONFIG

create_file "config/applocale.yml", config_file

puts ""
puts ""

puts "✅ Generated config/applocale.yml"

puts "🙌 You did it! The configuration is setup and you're all set for using the gem"
puts ""

puts "  - Pull your translations down with 'bundle exec applocale pull'"

puts " "
puts "See usage instructions: https://github.com/applocale/applocale-ruby"
Comments

Sign up or Login to leave a comment.