INNER CODE UNIT · JavaScript

translate

nisrulz/app-privacy-policy-generator · src/js/main.js:1

function translate(key, params) {
  var localeData = window.__locale || {}
  var text = localeData[key]
  if (text === undefined || text === null) return key
  if (!params) params = {}
  return text.replace(/\{\{(\s*)(\w+)(\s*)\}\}/g, function (match, before, name, after) {
    if (params[name] !== undefined) return params[name]
    if (this[name] !== undefined) return this[name]
    return match
  }.bind(this))
}

function _updateMeta() {
  var locale = window.__locale || {}
  if (locale['meta.title']) document.title = locale['meta.title']
  var metaDesc = document.querySelector('meta[name="description"]')
  if (metaDesc && locale['meta.description']) metaDesc.setAttribute('content', locale['meta.description'])
  var ogTitle = document.querySelector('meta[property="og:title"]')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…