Sven Fuchs
Recent Posts
-
Organizing translations with I18n::Cascade and I18n::MissingTranslations
February 2011
When it comes to I18n one of the questions I get asked most often is how to organize translation keys. So I thought I’d write down how we’re doing it at work, and thus adva-cms2.
DRY does not apply to L10n
Before I get into this let me (once again) explain why DRY doesn’t apply to L10n though because that’s the reason why we allow for those deeply nested keys and namespaces in I18n.
Here’s a slide from my Anatomy of Ruby I18n talk at Euruko 2010:
class Inter...
-
DatabaseRecorder - recording and replaying the database connection
February 2011
I’ve had this idea to record calls to the database connection for replaying “real” results later on a while ago. I’ve now found a few hours of time on the train and tried it out.
tl’dr: It doesn’t seem worth the effort. There’s no performance gain so far.
Here’s what I found:
Initial implementation
I’ve started out setting up a simple library database_recorder which wraps the execute method on the ActiveRecord::Base.connection into a c...
-
Travis - a distributed build server tool for the Ruby community
February 2011
So, I’ve started playing with the idea of a distributed build server tool once again in last year’s December … and Travis is what I came up with.
Status quo
Travis is currently running on http://travis.heroku.com and already notifies me about builds that pass or fail when someone pushes to those repositories I’ve registered for testing purposes.
The builds run on a virtual server that Julian Fischer has very kindly granted for this experiment.
The frontend is imp...
-
Why exactly don't we stub that database?
November 2010
Ok, when it came to unit tests I’ve been in the heavy-mocking-and-stubbing camp a few years ago. But then I’ve then seen our team (including myself) crash into the same issue over and over again: the fact that with mocks/stubs one does not test the real thing. One tests mocks and stubs which can easily get out of sync with the “real thing”, i.e. ActiveRecord models in our case.
So I’ve completely turned away from my previous position. Our tests became somewhat s...
-
Travis - an experimental, distributed CI server on Heroku
June 2010
Please note that this information is completely outdated.
If you've got here via Google searching for a distributed build server tool that runs on Heroku, then please refer to this article.
We had the I18n gem tested on runcoderun, a great service for open source projects to run continous integration on the web, and this was working very well for us. Unfortunately runcoderun was taken down.
So I figured it should be easy to setup a few apps on Heroku and have them run the I18n test suite on...
-
Release your Gems with ease
April 2010
After the recent, somewhat heated discussion about whether or not to check in gemspecs to a repository, manually crafting versus autogenerating them, using a dynamic piece of code to collect relevant files versus maintaining a static files list in the gemspec file ... I've felt motivated to polish my own gem plugin that I've been using to publish my gems and finally add some of the functionality that I've been missing myself.
In short, I'm a happy resident in the camp of manually maintained ...
-
Aligning rubygems + bundler through rubylib environment variable
March 2010
Put this into your ~/.zprofile (or ~/.profile or whatever makes sense for your shell):
export RUBYLIB=$RUBYLIB:~/.ruby
Source the file:
$ source ~/.zprofile
Put this to ~/.ruby/b.rb
begin
# should probably check parent directories, too?
require File.expand_path('../.bundle/environment')
rescue LoadError
require 'rubygems'
require 'bundler'
Bundler.setup
end
Done.
You can now:
$ ruby -rb test/all.rb # run test/all.rb in the context of your bundle
$ ruby -rubygems t...
-
Experimental Ruby I18n extensions: Pluralization, Fallbacks, Gettext, Cache and Chained backend
July 2009
Backend::Simple < Backend::Base
In Ruby what is the most obvious, elegant and maintainable pattern to extend an existing class' or object's functionality? No, the answer to that is definitely *not* in using alias_method_chain. It's simply including a module to that class. You probably knew that already ;)
We've done this with the I18n Simple backend before but one needs to extend the Simple backend first in order to then inject additional modules to the inheritance chain so that these mo...
-
Ruby I18n Gem hits 0.2.0
July 2009
Here's the release announcement on the rails-i18n mailinglist:
I've bumped the gem version to 0.2.0 and tagged v0.2.0 today.
Most importantly it includes:
* Lambda support (aka Yaroslav-prevails edition)
* Custom separators (aka Gettext-p0wned edition)
* Ruby 1.9 interpolation syntax (aka Masao-Mutoh-rocks edition)
For more details check out the changelog.
Thanks to everybody involved!
We still haven't managed to get the inclusion of Rails' vendorized gem right.
Thus it's currently not...
-
Using Ruby 1.9 Ripper
July 2009
While Ripper parses your code it continously fires events (or “calls callbacks”) when it finds something interesting. There are two types of events: scanner (lexer) and parser events.
The scanner basically goes through the code from the left to the right character by character. When it finds known things (such as a keyword, whitespace or a semicolon) it fires a corresponding even that you can react to. The parser works on a higher level and watches for known Ruby constructs (such...
-
Ripper2Ruby: modify and recompile your Ruby code
July 2009
So, the combination Ripper/Ripper2Ruby lets you do similar things as you can do with ParseTree or RubyParser and Ruby2Ruby. The differences are:
Ripper requires Ruby 1.9 (I was told it possibly could be compiled to work with Ruby 1.8.x but I don’t know anything further. Please drop me a note if you know how to do this.)
Ripper2Ruby builds a full object-oriented representation of Ruby code. That means you can modify the representation much more easily compared to the rough sexp tree ...
-
Rails I18n revs up: Globalize2 preview released!
September 2008
Please note: the following explanations assume that you're familiar with the new I18n API in Rails and might leave some unanswered questions otherwise :-). Also note that this is a preview release targeted at Rails I18n developers. We'll do at least one more release and provide more complete documentation about how Globalize2 can be used by end users then.
Globalize2 preview
The first preview release of Globalize2 includes the following features and tools. Most of them can be used indepen...
-
The Future of I18n in Ruby on Rails - RailsConf Europe 2008
September 2008
Welcome everybody!
I'm very happy to talk about "The future of Internationalization in Ruby on Rails" today.
So, who’s me?
This never occurred to me before but in a recent RailsEnvy podcast I’ve learned that my name could be pronounced like this ...
If you want to google me ...
... you probably have better luck using this.
I'm currently living in Berlin and I love it :)
I started programming in 1984
I've been in business as a developer, mostly as a web developer for ...
-
Ruby on Rails I18n, RailsConf Europe and Globalize2
August 2008
RailsConf Europe talk: "The future of I18n in Ruby on Rails"
I'll be giving a talk about "The future of I18n in Ruby on Rails" on RailsConf Europe next week together with Marko Seppae.
Am I excited about it? You bet! Will that be an interesting talk for everyone involved into Rails I18n? Of course, I'm sure :)
Also, there are some plans to also work on I18n/Rails during the Code Community Drive but I'm not sure what the status of this is right now.
I'm personally planning to take care o...
-
The Ruby on Rails I18n core api
July 2008
The pivotal point of the new I18n api in Rails is the I18n
module which is provided as a gem and shipped with Rails in ActiveSupport's
vendor directory. This module comes with the following features:
The main translation method #translate which is used to lookup translations.
The #localize method which is used to localize Date, DateTime and Time objects.
It stores the current locale in Thread.current.
It stores a default locale which is used when no locale has been passed or set.
It stores...
Older posts →