module Rosetta::Translatable

Overview

Include this module in any class where you need to translate many keys.

Defined in:

rosetta/translatable.cr

Macro Summary

Macro Detail

macro r(key) #

Finds the translation for the given key. If the given key starts with a ".", a prefix based on the current class name will be used. Unless a Rosetta::Translatable::Config annotation is defined with a value for prefix, which will then be used instead.

@[Rosetta::Translatable::Config(prefix: "user")] class Person include Rosetta::Translatable

def greeting r(".welcome_message").t # => key resolves to "user.welcome_message" end end


[View source]