PageSourceSearch

https://blackboard.lasierra.edu/javascript/i18n.js?v=4000.21.0-rel.33+e2d29c3

js lasierra.edu collected 2026-09-24 18:44:54 UTC 2,031 bytes, 72 lines download raw bytes

1/* ==================================================================
2 * General i18n functions
3 * Copyright (c) 2001 by Blackboard, Inc.,
4 * 1899 L Street, NW, 5th Floor
5 * Washington, DC, 20036, U.S.A.
6 * All rights reserved.
7 * Submit RFC & bugs report to: [email protected]
8 * This software is the confidential and proprietary information
9 * of Blackboard, Inc. ("Confidential Information").  You
10 * shall not disclose such Confidential Information and shall use
11 * it only in accordance with the terms of the license agreement
12 * you entered into with Blackboard.
13 * ==================================================================*/
14
15// internal methods
16
17function _escape(string)
18{
19  // ?= does not seem to work
20  return (''+string).replace(/^'|([^\\])'/g, "$1\\'").replace(/\n/g, "&crlf;");
21}
22
23
24function _unescape(string)
25{
26  return string.replace(/&crlf;/g, "\n");
27}
28
29function _substitute(string, parameters)
30{
31  for ( var key in parameters)
32  {
33    if ( parameters.hasOwnProperty( key ) )
34    {
35      string = eval( "string.replace(/\\{" + key + "\\}/g, '" + _escape(parameters[key]) + "')" );
36    }
37  }
38  return _unescape(string);
39}
40
41// Public methods: these methods are instance methods of dynamically generated
42// Javascript bundle objects. See Java class blackboard.platform.intl.JsResource
43// and Perl module CI::L10n::JsResource.
44
45
46// Get a string from a resource bundle
47function i18n_get_string(key)
48{
49  return this[key];
50}
51
52
53// Get string and perform substitution using positions (arrays) or names (object)
54function i18n_get_formatted_string(key, parameters)
55{
56  var string = this.getString(key);
57  if (string && parameters)
58  {
59    // Convert to object keyed by string representation of array index
60    if ( parameters.constructor.toString() == [].constructor.toString() )
61    {
62      var array = parameters;
63      parameters = {};
64      for (var i = 0; i < array.length; ++i)
65      {
66        parameters[''+i] = array[i];
67      }
68    }
69    string = _substitute(string, parameters);
70  }
71  return string;
72}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.