Hobo Cookbook

View Source

Rapid

<your>

Similar to <you>, but renders “Your” or “Fred’s” or equivalent localized strings

Attributes

  • capitalize: the first letter of the resulting sentence will be capitalized
  • count: used in pluralization. If omitted it will be set to 1.
  • key: used to lookup the translation in the locale file. It allows 3 different options: - single key like ‘message’: simple translation in ‘tags.your.message.current_user’ or ‘tags.your.message.other_user’ - composite key like ‘any.namespace.message’: translation as for the previous case, but it will translate also the ‘any.namespace.message’ and will interpolate the variable <key> (in this case :message) in the translation - when key is omitted it will be set to “default” and will do the translation with that key. Pass other meaningful attributes to achieve a dynamic usage
  • any other attribute passed to the tag will be used as a variable for interpolation

Notes

  • The :name variable is added by default as an interpolable variable
  • If no translation is found an automatic (only english) default is generated: the Your/Jim’s string, joined to the tag content. If you pass an explicit ‘default’ attribute you will override the automatic default.

Examples

it:
  tags:
    your:
      message:
        current_user:
          one: "Tuo Messaggio"
          other: "Tuoi Messaggi"
        other_user:
          one: "Messaggio di {{name}}"
          other: "Messaggi di {{name}
      entry:
        current_user:
          one: "Tua {{entry}}"
          other: "Tue {{entry}}"
        other_user: "{{entry}} di {{name}}"
  • <your key="message" count=>"&messages.count"/>:

  • count => 1: “Tuo Messaggio” or “Messaggio di Jim”

  • count => 5: “Tuoi Messaggi” or “Messaggi di Jim”

  • <your key="activerecord.models.entry" count=>"&this.entries.count"/>:

  • count => 1: “Tua Entrata” or “Entrata di Jim”

  • count => 5: “Tue Entrate” or “Entrate di Jim”

  • <your>Posts</your>: “your Posts” or “Jim’s Posts”

Show Source

Comments

No Comments to display