Sha256: 13ba3fb2337c70da23bdac0898bc01abbd1a53e7bd93e679b131379398259bba

Contents?: true

Size: 1.61 KB

Versions: 33

Compression:

Stored size: 1.61 KB

Contents

<!--
Wrapper around the Rails :translate helper with hobo added features.

It can be used as a regular helper or as a dryml tag.

### Hobo Added Features

`ht` 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")

You can also pass any other :translate option like for example :count.

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.

sample.no.yml-file:

      "no":
        my: "Mitt {{app}}"

The output should be: Mitt Program

Another example:

    <%= ht :key=>'user.index.title', :default=>'Index'  %>
    <ht key="user.index.title">Index</ht>
    #=> "Index" # if "user.index.title" or "hobo.index.title" is not found
    #=> "User Index" # with the below en.yml file

    === en.yml ===
    en:
      hobo:
        index:
          title: %{model} Index
-->
<fakedef tag="ht">
<!-- actually defined in translations.rb -->
</fakedef>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hobo_rapid-2.2.6 taglibs/i18n/ht.dryml
hobo_rapid-2.2.5 taglibs/i18n/ht.dryml
hobo_rapid-2.2.4 taglibs/i18n/ht.dryml
hobo_rapid-2.2.3 taglibs/i18n/ht.dryml
hobo_rapid-2.2.2 taglibs/i18n/ht.dryml
hobo_rapid-2.2.1 taglibs/i18n/ht.dryml
hobo_rapid-2.2.0 taglibs/i18n/ht.dryml
hobo_rapid-2.1.2 taglibs/i18n/ht.dryml
hobo_rapid-2.1.1 taglibs/i18n/ht.dryml
hobo_rapid-2.1.0 taglibs/i18n/ht.dryml
hobo_rapid-2.1.0.pre4 taglibs/i18n/ht.dryml
hobo_rapid-2.1.0.pre3 taglibs/i18n/ht.dryml
hobo_rapid-2.1.0.pre2 taglibs/i18n/ht.dryml
hobo_rapid-2.1.0.pre1 taglibs/i18n/ht.dryml
hobo_rapid-2.0.1 taglibs/i18n/ht.dryml
hobo_rapid-2.0.0 taglibs/i18n/ht.dryml
hobo_rapid-2.0.0.pre10 taglibs/i18n/ht.dryml
hobo_rapid-2.0.0.pre9 taglibs/i18n/ht.dryml
hobo_rapid-2.0.0.pre8 taglibs/i18n/ht.dryml
hobo_rapid-2.0.0.pre7 taglibs/i18n/ht.dryml