MCPcopy
hub / github.com/NUKnightLab/TimelineJS3 / _

Method _

src/js/language/Language.js:90–100  ·  view source on GitHub ↗

* Look up a localized version of a standard message. While using `_` for the * method name is not exactly idiomatic javascript, it was inspired by Python's * https://docs.python.org/3/library/gettext.html|gettext module, with * the intention of reducing clutter in places where

(k, context)

Source from the content-addressed store, hash-verified

88 * @returns {string} - a localized string appropriate to the message key
89 */
90 _(k, context) {
91 let msg = this.messages[k] || Language.fallback.messages[k] || k;
92 if (msg.match(MESSAGE_VARIABLE_PATTERN)) {
93 if (!context) throw new TLError("template_message_without_context")
94 for (let match of msg.matchAll(MESSAGE_VARIABLE_PATTERN)) {
95 if (!(match[1] in context)) throw new TLError("template_message_without_context")
96 msg = msg.replace(match[0], context[match[1]])
97 }
98 }
99 return msg
100 }
101
102 formatDate(date, format_name) {
103

Callers 15

loadingMessageMethod · 0.45
errorMessageMethod · 0.45
errorHandlerFunction · 0.45
_loadMediaMethod · 0.45
createMediaMethod · 0.45
_loadMediaMethod · 0.45
_loadMediaMethod · 0.45
createMediaMethod · 0.45
_loadMediaMethod · 0.45
createMediaMethod · 0.45
_loadMediaMethod · 0.45
createMediaMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected