HexagonJS
Edit Page
User Facing Text
A module used for defining the default text for hexagon modules.
All the default text within hexagon is now defined using this module. It can be overriden for each instance if required using the options for each component.
This module can also be used as a method for localisation of user facing text.
Hexagon provides all text in English.
Examples
// Get and set inbuilt values:
hx.userFacingText('form', 'missingValue') // Get the text for the 'form' module and 'missingValue' key
hx.userFacingText('form', 'missingValue', 'Value Missing') // Set the text

// Get and set custom values
hx.userFacingText('yourComponentName', 'yourKeyValue', 'Some Text') // Set a custom user facing text
hx.userFacingText('yourComponentName', 'yourKeyValue') // Returns: "Some Text"

// Get all set values
hx.userFacingText()

// Set multiple values
var text = {
  form: {
    missingValue: 'Value Missing'
  },
  yourComponentName: {
    yourKeyValue: 'Some Text'
  }
}
hx.userFacingText(text)
Api
Functions
hx.userFacingTextObject
Get the currently set text for all modules
Returns
Object
The currently set userFacingText object
hx.userFacingTexttextObject
Sets multiple module text keys:
var text = {
  picker: {
    chooseValue: 'Text'
  },
  form: {
    typeMismatch: 'Type mismatch error',
    missingValue: 'Missing Value'
  }
}
hx.userFacingText(text)
It can also be used to reset the text to the default values
hx.userFacingText(hx.userFacingText.defaults())
Arguments
text
The object with module/key objects to set.
hx.userFacingTextmoduleStringkeyStringString
Gets the text for a module key
Arguments
moduleString
The module to get text from
The key to get text for
Returns
The currently set text
hx.userFacingTextmoduleStringkeyStringvalueString
Sets the text for a module key
Arguments
moduleString
The module to set text for
The key to set text for
valueString
The text to set
hx.userFacingText.defaultsObject
Returns
Object
The initial value set for the userFacingText object.