For the attention of last week

archive of tokumine.com

Month: July, 2010

UN flag suitable for famfamfam icon set

UN flag for the fam fam fam flag icon set

UN flag for fam fam fam

Totally geeky way to spend a lunchtime, but what the hey. Here’s some takes on a 16×11 pixel UN flag paying homage to the FamFamFam style.

They should fit in well with the FamFamFam flag icons set available here: http://www.famfamfam.com/lab/icons/flags/

PostgreSQL friendly IPinfodb SQL import

Title says it all really. I finally got tired of importing the ipinfodb into postgreSQL via CSV (the SQL they provide on their site targets MySQL), and have made a dump available on S3. Knock yourself out.

http://stokumine.s3.amazonaws.com/ipinfodb_one_table_small_pgsql.sql.gz

to use:

psql -U[your_user] [your_db] < ipinfodb_one_table_small_pgsql.sql

creates a table called geo_ips

Using Tolk with Google Translate

I love DHH’s Tolk. For those that don’t know, it’s a rails engine that makes translating your base locale in your Rails app really easy . While I was translating, I was getting bored with doing simple things like translating the days of the week and so on, and sometimes needed help with more complex┬ásentences. This is my fork of Tolk that autotranslates your translation string with google translate to give you a sensible starting point rather than a white box.

It’s on github: http://github.com/tokumine/tolk/

http://vimeo.com/moogaloop.swf?clip_id=13429054&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00ADEF&fullscreen=1

Tolk and Google Translate from Simon Tokumine on Vimeo.

Using split locale files with Tolk

The vanilla method of storing view translations in an i18n’d Rails project is to maintain a huge locale yaml file. A step forwards is to maintain many yaml files split into folders mirroring your controller or view structure. Splitting is better for maintenance, however many tools and services, like DHH’s Tolk which can help with the actual translation of your site currently rely on your locale being in one place.

I wanted both. I’d like to maintain my base locale files in a nice split structure, whilst at the same time being able to use tools like Tolk to maintain my translations.

With your base locales arranged as described by the Rails Guides simply use the following rake task to generate an aggregated locale YAML file. To ensure no keys are overwritten, be sure to maintain your translations in their own namespaces.