Module: ko/locale

This module interfaces with Mozilla's nsIStringBundleService, it allows you to use it with as little logic as possible.

If used from a module you can place your properties file in locale/en-US/modulename.properties to bypass having to call .use()

Example

var l = require("ko/locale").use("path/to/file.properties");
console.log(l.get("hello", "world"));
Author:
  • ActiveState
License:
  • Mozilla Public License v. 2.0

Methods


require("ko/locale").get(name)

Get localization string

Parameters:
Name Type Description
name String
args.. String

Formatted strings

Returns:
Type
String

require("ko/locale").getBundleURI()

retrieve the matched bundle (properties) file uri for the current context

Returns:
Type
String

require("ko/locale").use( [properties])

Use the given locale properties file

Parameters:
Name Type Argument Description
properties String <optional>

Properties file, this is optional when used from an addon context that has a properly structured localization file

Returns:

Returns an object with an equivalent of the module:ko/locale~get method

Type
object