Skip to Content

JavaScript File

URL: https://www.we-are-digital.co.uk/hs/hsstatic/cos-i18n/static-1.53/bundles/project.js
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Tue, 09 Nov 2021 16:12:42 GMT
Download Time: Less than a second
Cookies: None
Size: 2 KB
HTTP Headers:  19 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
  
OK Issues: No issues found

1"use strict";function hs_i18n_log(n){console.log("i18n_getmessage: "+n)}

2function hs_i18n_substituteStrings(n,e){var s=n.match(new RegExp("\\$[0-9]+","g"));if(null==s)return n;for(var r=0;r<s.length;r++){var l=s[r],t=parseInt(l.replace("$",""));t<=0||null==e||t>e.length?hs_i18n_log("no substitution string at index "+t+" found for string '"+n+"'"):n=n.replace(l,e[t-1])}

3return n}

4function hs_i18n_insertPlaceholders(n,e){var s=n.message,r=s.match(new RegExp("\\$\\w+\\$","g"));if(null==r)return s;for(var l=0;l<r.length;l++){var t=r[l],o=t.replace(new RegExp("\\$","g"),"").toLowerCase(),a=n.placeholders[o];null==a&&hs_i18n_log("no placeholder found for '"+o+"'");s=s.replace(t,a.content)}

5return(s=hs_i18n_substituteStrings(s,e)).replace(/\$\$/g,"$")}

6function hs_i18n_getMessage(n,e){if(null==n){hs_i18n_log("no messages found");return""}

7var s=arguments[2];if(null==s||0==s.length||null==s[0]){hs_i18n_log("no message name passed");return""}

8var r=s[0],l=e.split("-")[0],t=n[e]||n[l];if(null==t){hs_i18n_log("no messages found for language '"+e+"'");return""}

9var o=t[r]||n[l][r];if(null==o){hs_i18n_log("no message found for language '"+e+"' named '"+r+"'");return""}

10return null==o.placeholders?o.message||"":hs_i18n_insertPlaceholders(o,s[1])}