3.2.3 • Published 3 years ago

next-core-bundle v3.2.3

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
3 years ago

next-core-bundle

Augmented.js Next Core - Resource Bundle

Description

Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.

This allows you to write programs that can:

  • be easily localized, or translated, into different languages
  • handle multiple locales at once
  • be easily modified later to support even more locales

API

Table of Contents

ResourceBundle

ResourceBundle

Parameters

  • options (optional, default {})

_fallback

Properties

  • fallback boolean Is fallback support enabled

_bundle

Properties

_delimiter

Properties

  • delimiter string The key delimiter (if fallback is enabled)

get

Get a string from the bundle by key

Parameters

  • key string The key to find in the bundle

Returns string Message from bundle, key if not found, or null if missing the key

Properties

Properties

Properties

MessageKeyFormatter

Concatenate the pieces of the message together if a portion of the key is missing, the rest of the key is ignored. ex. if the "rule" attribute is missing, then the key will return with the message.level + message.kind only

Parameters

  • options (optional, default {})

_delimiter

Key Delimiter

Properties

  • delimiter string The delimter used to seperate each key

format

Format a key for a message

Parameters

  • message object The message to format (optional, default {})

Returns any The key to lookup in a bundle

MapFormatter

MapFormatter - Maps a JSON object of keys to new text

format

Replaces a string with replacement text from a JSON object.
Will replace all instances marked with the key name

Parameters

  • message string The original string
  • replacements object Object with replacement strings

Examples

const message = MapFormatter.format("This is a test of {ebs}.", { "ebs": "the Emergency Broadcast System" });

Returns string Returns the string with replaced text

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

2.5.4

4 years ago

2.5.3

6 years ago