class

JSONSchema::I18N

Inherits Reference / Object

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)

Instance methods

get(key)

Used internally to display translated messages.

Source
get(key, *strings)
Source
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.

Source