Using .po files to generate translated text

I need to create a multi-language website.
I have done this many times in Wordpress with WPML or qTranslate using gettext and .po files. This allows the wrapping of text in <?php _e("Text here"); ?> and then with Poedit these are added to a .po file, translated and then this creates a .mo file to translate the site.

Is there a similar way to do this with Middleman?

Thanks.

Middleman uses I18n from http://guides.rubyonrails.org/i18n.html .
The toolchain might be different but I think that the possiblities compare quite well.

For working with po(t) and mo(t) files there are various ruby gems. Pretty sure there is a gettext gem for sinatra which is compatible with middleman.

Hello, sorry to revive this old post.

What is the best way to implement a ruby gem, such as gettext, into middleman?

Generally, I think, put them in Gemfile and just require it if/where needed. My config.rb file has:

before_build do |builder|
  require 'uglifier'
  print "Before_build actions... "
  print "minifying lazy-retina.js... "
  File.open("source/js/_lazy-retina.min.js", "w") do |file| 
      file.write Uglifier.compile(File.read("source/js/_lazy-retina.js"), :mangle => false, :comments => /Lazy Retina/)
  end
  puts "done."
end

Uglifier is part of MM install, but it’s not automatically required in config-file, that’s why I manually do it. I also use, for example, this gem in my Gemfile:

gem 'sort_alphabetical' # https://github.com/grosser/sort_alphabetical

and just use it in template code, without requiring:

  <% blog.articles.group_by {|a| a.data.category }.sort_alphabetical.each do |category, articles| %>

That is a general advice regarding gems, not gettext specifically.