UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

76 lines (58 loc) 2.08 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The source code</title> <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../resources/prettify/prettify.js"></script> <style type="text/css"> .highlight { display: block; background-color: #ddd; } </style> <script type="text/javascript"> function highlight() { document.getElementById(location.hash.replace(/#/, "")).className = "highlight"; } </script> </head> <body onload="prettyPrint(); highlight();"> <pre class="prettyprint lang-js">/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ // Localization helper Siesta.Resource = (function () { var cacheByNamespace = {} var Resource = Class({ does : Siesta.Util.Role.CanFormatStrings, has : { dict : null }, methods : { &#39;get&#39; : function (key, data) { var text = this.dict[ key ]; if (text) return this.formatString(text, data); if (window.console &amp;&amp; console.error) { window.top.console.error(&#39;TEXT_NOT_DEFINED: &#39; + key); } return &#39;TEXT_NOT_DEFINED: &#39; + key; } } }) return function (namespace, key, data) { var dictionary = Siesta.CurrentLocale[ namespace ]; if (!dictionary) { throw &#39;Missing dictionary for namespace: &#39; + namespace; } var resource = cacheByNamespace[ namespace ] if (!resource) { resource = cacheByNamespace[ namespace ] = new Resource({ dict : dictionary, serializeFormatingPlaceholders : false }) } if (key) return resource.get(key, data) return resource } })(); </pre> </body> </html>