giant robots smashing into other giant robots

Written by thoughtbot

highwaybobbery

Date and time formats for pirates

Need to display a date in your Rails app? First try:

Time.now.strftime "arrrround %H'ish"

To remove duplication, you imagine a time format initializer. Second try:

Time.now.to_s :pirate

Then you remember the :default localized key. Third time’s a charm:

l Time.now

It formats based on the config/locales/en.yml file:

en:
  time:
    formats:
      default: "arrrround %H'ish"
  date:
    formats:
      default: "arrrround %H'ish"

Dates work, too:

l Date.today

The same system lets you alter the display of “days ago” and “minute from now.”

dancroak

Copycopter is now open source

One month ago, we informed Copycopter customers that we would be shutting the service down on April 15th and they would no longer be charged.

This news triggered a domino effect across the internet. AOL followed up by shutting down Instant Messenger. Milk then shut down Oink and users are fretting that Posterous will shut down after its acquisition by Twitter.

Copycopter logo

Why are we shutting it down?

Copycopter has worked beautifully for its purpose: editing live copy in Rails app using the I18n (internalization) API.

However, as a business, we try to make money and Copycopter has not served that purpose very well. So, we’ve been spending our time on other things.

What is happening to Copycopter now?

It is open source!

Why are we open sourcing it?

  1. It’s not really cool to run a service, then abruptly shut it down. We want to be awesome to our paying customers, many of whom still want to use the service.

  2. Copycopter is fantastic if you’re into Rails, translations, and not editing code and deploying every time copy changes.

  3. Open source code is the bee’s knees.

All the code has been moved over to the “copycopter” organization on Github. There, you’ll also find the Ruby client and a tight little style guide.

Who is maintaining it?

The fine folks at Crowdtap and Iora Health, two very strong Rails teams in New York and Boston, respectively.

They both use Copycopter for their own production apps.

How do I set it up as a new user?

Follow these instructions.

Or, watch this instructional, holiday-themed screencast:

How do I migrate my app from copycopter.com to open source?

Follow these instructions.

Thank you!

Thank you to all of Copycopter’s customers. We’re sorry we can no longer run the service but we’d be even sorrier if we gave you a half-assed effort.

We’re thrilled to be able to give Copycopter new life as an open source project and extremely grateful to the folks at Crowdtap and Iora Health for maintaining it.

We know them well from working together in the past. You might even call us friends.

Since open source is about people, you should get to know their handsome faces:

image image image image image image image image image John Norman Will Mernagh

Get to the choppah!

Written by .

jasonmorrisontb

Copycopter now supports editing multiple locales

Does your Rails app have more than one locale? Is it a pain to edit your internationalized copy?

We’ve heard your requests to better support multiple locales, and are excited to roll out multiple locale support in Copycopter.

You can try out the new multiple locale support in your existing Copycopter-backed apps, read more about how it works, or check it out during a free trial.

You’ll be able to manage the copy for multiple locales, share this responsibility with content experts on your team, and continue to roll out fresh updated copy without the overhead of redeploying your app. Copycopter will continue to hum along, serving up draft content to your development and staging environments while delivering content you mark as “published” to production.

If you already have multiple locales in your Copycopter app, great news! The locales are already in Copycopter, ready for editing. In fact, adding new locales to Copycopter is as easy as adding them to your Rails app. We’re continuing to stick with the Rails I18n API as a solid foundation, and adhering to its use for Copycopter.

We’d love to hear how you are using the multiple locale support in Copycopter. Let us know how it fits into your workflow.

Want to edit live copy in your Rails app without redeploying? Try Copycopter free for 30 days.

dancroak

Custom date and time formats in Rails

We wanted to shorten the “about 1 month ago” text in an information-rich table that was squeezing created_at data.

wrapping onto multiple lines

We can override distance_in_words with the i18n API (and, by extension, time_ago_in_words).

Speaks English real good

A quick change to config/locales/en.yml and we’re done:

en:
  datetime:
    distance_in_words:
      less_than_x_seconds:
        other: '1 minute'
      half_a_minute: '1 minute'
      less_than_x_minutes:
        one: '1 minute'
      x_minutes:
        one: '1 minute'
        other: '{{count}} minutes'
      about_x_hours:
        one: '1 hour'
        other: '{{count}} hours'
      about_x_months:
        one: '1 month'
        other: '{{count}} months'
      about_x_years:
        one: '1 year'
        other: '{{count}} years'
      over_x_years:
        one: 'over 1 year'
        other: 'over {{count}} years'

The result:

fits on one line

You can see other options in svenfuchs/i18n.

Written by .

dancroak

International authentication library of mystery

In May, Timur Vafin, Marcel Goerner, and Eugene Bolshakov helped make Clearance i18n-aware.

Baxter, you know I don’t speak Spanish

Even if your language is English, this means you can control all of Clearance’s flash keys and email subjects from one YAML file.

Pretty sweet! Thanks for the patches, fellas.

en:
  flashes:
    failure_when_forbidden:
      'Please double check the URL or try submitting the form again.'
    failure_after_update:
      "Password can't be blank."
    failure_after_create:
      'Bad email or password. Are you trying to register a new account?
       <a href="%{sign_up_path}">Sign up</a>.'
  helpers:
    submit:
      password:
        submit:
          'Reset password'
      password_reset:
        submit:
          'Save this password'
      session:
        submit:
          'Sign in'
      user:
        create:
          'Sign up'
    label:
      password:
        email:
          'Email address'
      password_reset:
        password:
          'Choose password'
  layouts:
    application:
      sign_in:
        'Sign in'
      sign_out:
        'Sign out'
  passwords:
    create:
      description:
        'You will receive an email within the next few minutes.
         It contains instructions for changing your password.'
    edit:
      title:
        'Change your password'
      description:
        'Your password has been reset. Choose a new password below.'
    new:
      title:
        'Reset your password'
      description:
        'To be emailed a link to reset your password, please enter your email
         address.'
  sessions:
    new:
      title:
        'Sign in'
      sign_up:
        'Sign up'
      forgot_password:
        'Forgot password?'
  users:
    new:
      sign_in:
        'Sign in'
  clearance_mailer:
    change_password:
      beginning_paragraph:
        'Someone, hopefully you, requested we send you a link to change your
         password:'
      ending_paragraph:
        "If you didn't request this, ignore this email. Your password hasn't
         been changed."

Written by .