Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Edit copy in your live web app.
Ruby

This branch is even with copycopter:at_exit

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.bundle
features
gemfiles
lib
spec
tmp
.gitignore
Appraisals
Gemfile
Gemfile.lock
MIT-LICENSE
README.textile
Rakefile
copycopter_client.gemspec
init.rb

README.textile

Copycopter Client

This is the client gem for integrating apps with Copycopter.

The client integrates with the I18n gem so that you can access copy text and translations from a Copycopter project.

Installation

Just install the gem:

gem install copycopter_client

Rails 3

Add the following line to your Gemfile:

gem "copycopter_client"

Then run bundle install.

Rails 2

Add the following line to your config/environment.rb:

config.gem 'copycopter_client'

Then run rake gems:install. We also recommend vendoring the gem by running rake gems:unpack:dependencies GEM=copycopter_client.

Configuration

Add the following to your application:

CopycopterClient.configure do |config|
  config.api_key = "YOUR API KEY HERE"
end

In a Rails application, this should be saved as config/initializers/copycopter.rb. You can find the API key on the project page on the Copycopter website. See the {CopycopterClient::Configuration} class for a full list of configuration options.

Usage

You can access blurbs from Copycopter by using I18n.translate. This is also aliased as translate or just t inside Rails controllers and views.

# In a controller
def index
  flash[:success] = t("users.create.success", :default => "User created")
end

# In a view
<%= t(".welcome", :default => "Why hello there") %>

# Global scope (for example, in a Rake task)
I18n.translate("system.tasks_complete", :default => "Tasks complete")

# Interpolation
I18n.translate("mailer.welcome", :default => "Welcome, %{name}!", :name => @user.name)

See the I18n documentation documentation for more examples.

Deploys

Blurbs start out as draft copy, and won’t be displayed in production environments until they’re published. If you want to publish all draft copy when deploying to production, you can use the copycopter:deploy rake task:

rake copycopter:deploy

About

Copyright © 2010 thoughtbot, inc., released under the MIT license

Something went wrong with that request. Please try again.