HexagonJS
User Facing Text Changelog
1.20.0
hx.userFacingTextString
Updated
This function will now show a console warning when it returns a string with a $param in.
Call with hx.userFacingText(module, key, parameters) to replace the parameters immediately or call hx.userFacingText(module, key, true) if you need to retain the current functionality and hide the warning.
hx.userFacingText
Updated
Updated the value argument to allow an array to be set, allowing plurals.
hx.userFacingText('example', 'plural-key', [
  [null, 0, 'Value Zero'],
  [1, 1, 'Value Singular'],
  [2, 2, 'Value Two'],
  [3, null, 'Value $n']
])

hx.userFacingText('example', 'plural-key')
hx.userFacingText('example', 'plural-key', { n: 1 })
// => 'Value Singular'

hx.userFacingText('example', 'plural-key', { n: 0 })
// => 'Value Zero'

hx.userFacingText('example', 'plural-key', { n: 2 })
// => 'Value Two'

hx.userFacingText('example', 'plural-key', { n: 100 })
// => 'Value 100'
hx.userFacingTextString
Updated
Added a new function for getting the user facing text with parameters
hx.userFacingText.format
Added
Expose the function used in Hexagon to format strings with parameters
hx.userFacingText.toMultilineSelectionSelection
Added
Added a utility for converting a text string with \n characters into a selection containing span elements separated by br elements
1.4.0
Added
Added a new module for managing all the user facing text in hexagon