class JSONSchema::I18N

Overview

Allows translation of generated messages (mostly exceptions). Generally you do not need to interact with this class, other than to set the lang to a custom configuration.

To create your own translation, copy the value EN_US from the source and define it in your application (with a different constant name). Translate the strings, ensuring that the keys are not changed. Then, call #set_lang:

require "jsonschema"

LANG = {
  0 => "..",
  # ...etc
}

JSONSchema.i18n.set_lang(LANG)

Defined in:

i18n.cr

Instance Method Summary

Instance Method Detail

def get(key) #

Used internally to display translated messages.


[View source]
def get(key, *strings) #

[View source]
def set_lang(lang : Lang) #

Set a user-created lang. A lang is just a Hash where the keys of the Hash are identical to the expected keys for the lang.

See the constant value EN_US for a reference.


[View source]