Sha256: 982054e5a90ae617d099ae3bbe832f49cc81dd2c4767f79ff00d37e882abc642

Contents?: true

Size: 916 Bytes

Versions: 5

Compression:

Stored size: 916 Bytes

Contents

# Translator/I18n

The translator plugin provides automatic translation of the templates using Gettext, Fast-Gettext or Rails I18n. Static text
in the template is replaced by the translated version.

Example:

    h1 Welcome to #{url}!

Gettext translates the string from english to german where interpolations are replaced by %1, %2, ...

    "Welcome to %1!" -> "Willkommen auf %1!"

and renders as

    <h1>Willkommen auf github.com/slim-template/slim!</h1>

Enable the translator plugin with

    require 'slim/translator'

# Options

| Type | Name | Default | Purpose |
| ---- | ---- | ------- | ------- |
| Boolean | :tr | true | Enable translator (Enabled if 'slim/translator' is required) |
| Symbol | :tr_mode | :dynamic | When to translate: :static = at compile time, :dynamic = at runtime |
| String | :tr_fn | Depending on installed translation library | Translation function, could be '_' for gettext |

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slim-5.2.1 doc/translator.md
slim-5.2.0 doc/translator.md
slim-5.1.1 doc/translator.md
slim-5.1.0 doc/translator.md
slim-5.0.0 doc/translator.md