Hobo Cookbook

View Source



Uses RoR native I18n.translate.

Adds some conventions for easier hobo translation.

  1. Assumes the first part of the key to be a model name (e.g.: users.index.title -> user)
  2. Tries to translate the model by lookup for: (e.g.: user-> activerecord.models.user)
  3. Adds a default fallback to the beginning of the fallback chain by replacing the first part of the key with “hobo” and using the translated model name as additional attribute. This allows us to have default translations (e.g.: hobo.index.title: “{{model}} Index”)

Is also used as a tag in the dryml-view files. The syntax is:

  <ht key="my.app">My Application</ht>

Will lookup the “my.app”-key for your locale and replaces the “My Application” content if found.

  <ht key="my" app="Program">My Application</ht>

Will look up both the “my”- and “app”-key for your locale, and replaces the “My Application” with the “my”-key contents (interpolated using the “app”-key.


    my: "Mitt {{app}}"

The output should be: Mitt Program

Otherwise with features as the ht method, step 1, 2 and 3 above.

For more information, see the manual

Show Source


No comments to display