Andrey Subbotin

He is really passionate about programming and does believe that good software would one day make the world a better place to live. All the Apple hardware, the Human Interface Guidelines, and the Web 2.0 standards make him do his best.
Twitter Facebook Flickr YouTube Last.fm LinkedIn FriendFeed

rabelyoda: Rails Localization Made Easy

I have always been fond of small utilities that do one thing, probably one deadly simple thing, and by that save you from lots of boring routine on a day-by-day basis.

Say, you’ve got a Ruby on Rails project. Say, you keep a dozen files in your config/locales folder. Say, you periodically need to sync all of them to the original en.yml file and send to your translators for an update. It’s usually very boring and the chance of missing a string or another is high.

So, here comes a nifty gem to help you with that.

What it does is as follows:

  1. It reads all config/locales/*.yml
  2. It outputs them to config/locales.out/*.yml
  3. It adds all missing strings from en.yml to the other ymls.
  4. For each such string, “[pls translate]” is added at the beginning, so it’s easy to identify them in the resulting file.
  5. It removes all strings not present in en.yml from the other ymls. 

After that you grab the resulting files from config/locales.out and send them over to your translators. When the translation is made, you simply overwrite your original files in config/locales. That’s it. Nothing else.

Give it a try:

sudo gem install rabelyoda
cd your-rails-project-folder
rabelyoda 

Or browse the code at GitHub.

La-lal-la-la-la-la-la. :)

iPhone 4 @2x assets made easy

We were updating our app’s graphics for the gorgeous screen of iPhone 4 the other day and it was a pain to update all the 163 PNG files we had and not to miss a thing.

So, I’ve come up with a simple Ruby script that checks that for each @1x image you have a properly sized @2x image.

The output it gives is like:

  FILES WITHOUT @1x VERSION ============================================
  status-new@2x.png

  FILES WITHOUT @2x VERSION ============================================
  Icon-Small.png
  logo.png
  message-bubble-left.png
  message-bubble-right.png
  no-photo-icon-boy-small.png
  no-photo-icon-girl-small.png
  nofriendsbg.png
  profile-gallery-super-star.png
  send-button.png
  share-on-network-bounds-rect.png

  INVALID IMAGE SIZES DETECTED FOR THE FOLLOWING FILES =================
  dashboard-checkin-button-full@2x.png: SIZE IS 506 x 94, EXPECTED 596 x 94

You can check it out on GitHub at: http://github.com/eploko/ios-png-check

Hopefully it will make life easier for some of you iPhone developers out there. :)