Hobo Cookbook

View Source

Rapid

<you>

Convenience tag to help with the common situation where you need to address the current user as “you”, and refer to other users by name

Parameters

  • default

Usage

The context should be a user object. If this == current_user the “you” form is rendered, otherwise the form with the user’s name:

  • <you have/> new mail -> “you have new mail” or “Jim has new mail”
  • <you are/> now an admin -> “you are now an admin” or “Jim is now an admin”
  • <you do/>n't want to go there -> “you don’t want to go there” or “Jim doesn’t want to go there”

The tag is also localized in the namespaces “tags.you.current_user” and “tags.you.other_user”. Each namespace can contain the legacy keys “have”, “are”, “do” used for the respective attributes, and “nothing” used when no attribute is passed. But you can also use your own keys, providing that you add the keys in the correct namespaces.

Examples

it:
  tags:
    you:
      current_user:
        nothing: "Tu"
        have: "Hai"
        are: "sei"
        can: "Puoi"
      other_user:
        nothing: "{{name}}"
        have: "{{name}} ha"
        are: "{{name}} è"
        can: "{{name}} può"
  • <you have/> un nuovo messaggio. -> “Hai un nuovo messaggio.” or “Jim ha un nuovo messaggio.”
  • Adesso <you are/> amministratore. -> “Adesso sei amministratore.” or “Adesso Jim è amministratore.”
  • <you can/> scrivere. -> “Puoi scrivere.” or “Jim può scrivere.”

(note: :name is added by default as an interpolable variable)

Attributes

  • capitalize: the first letter of the resulting sentence will be capitalized

Additional Notes

The “titleize” attribute is deprecated: use “capitalize” instead.

Show Source

Comments

No Comments to display