Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.04 KB

translator.md

File metadata and controls

31 lines (20 loc) · 1.04 KB

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 slim-lang.com!</h1>

Enable the translator plugin with

require 'slim/translator'

Options

TypeNameDefaultPurpose
Boolean:trtrueEnable translator (Enabled if 'slim/translator' is required)
Symbol:tr_mode:dynamicWhen to translate: :static = at compile time, :dynamic = at runtime
String:tr_fnDepending on installed translation libraryTranslation function, could be '_' for gettext