Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

preact-i18n

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact-i18n - npm Package Compare versions

Comparing version 2.2.0-preactx to 2.3.0-preactx

20

dist/preact-i18n.esm.js

@@ -197,12 +197,11 @@ import { createContext, h, cloneElement } from 'preact';

* Also supports json templating using the format: {{variable}}
* Falls back to default text.
* Falls back to default text.
*
* @private
* @param {String} id Intl field name/id (subject to scope)
* @param {String} [scope=''] Scope, which prefixes `id` with `${scope}.`
* @param {Object} dictionary A nested object containing translations
* @param {Object} [fields={}] Template fields for use by translated strings
* @param {Number} [plural] Indicates a quantity, used to trigger pluralization
* @param {String|Array} [fallback] Text to return if no translation is found
* @returns {String} translated
* @param {String} id Intl field name/id (subject to scope)
* @param {String} [scope=''] Scope, which prefixes `id` with `${scope}.`
* @param {Object} dictionary A nested object containing translations
* @param {Object} [fields={}] Template fields for use by translated strings
* @param {Number} [plural] Indicates a quantity, used to trigger pluralization
* @param {String|Array} [fallback] Text to return if no translation is found
* @returns {String} translated
*/

@@ -554,5 +553,6 @@ function translate(id, scope, dictionary, fields, plural, fallback) {

intl.useText = useText;
intl.translate = translate;
export default intl;
export { IntlContext, IntlProvider, Localizer, MarkupText, Text, intl, useText, withText };
export { IntlContext, IntlProvider, Localizer, MarkupText, Text, intl, translate, useText, withText };
//# sourceMappingURL=preact-i18n.esm.js.map

@@ -1,1 +0,1 @@

function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var l=require("preact"),p=require("preact/hooks"),a=t(require("dlv")),c=l.createContext({intl:{}});function f(t){return null!=t}function u(t,n){for(var r in n)t[r]=n[r];return t}function s(t,n){var r=u({},t);for(var e in n)n.hasOwnProperty(e)&&(t[e]&&n[e]&&"object"==typeof t[e]&&"object"==typeof n[e]?r[e]=s(t[e],n[e]):r[e]=t[e]||n[e]);return r}function d(t){if("string"==typeof(t=t||{})&&(t=t.split(",")),"join"in t){for(var n={},r=0;r<t.length;r++){var e=t[r].trim();e&&(n[e.split(".").pop()]=e)}return n}return t}function h(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&-1===n.indexOf(e)&&(r[e]=t[e]);return r}var v=/[?&#]intl=show/;function e(t){var n=t.scope,r=t.mark,e=t.definition,o=h(t,["scope","mark","definition"]),i=u({},p.useContext(c).intl||{});return n&&(i.scope=n),e&&(i.dictionary=s(i.dictionary||{},e)),(r||"undefined"!=typeof location&&String(location).match(v))&&(i.mark=!0),l.h(c.Provider,{value:{intl:i}},o.children)}function o(n,r){if(arguments.length<2)return r=n,function(t){return o(t,r)};function t(t){return l.h(e,r||{},l.h(n,t))}return t.getWrappedComponent=n&&n.getWrappedComponent||function(){return n},t}var i={};function x(t,n,r,e){return t&&t.replace(/\{\{([\w.-]+)\}\}/g,y.bind(null,n||i,r,e))}function y(t,n,r,e,o){for(var i=o.split("."),u=t,l=0;l<i.length;l++){if(null==(u=u[i[l]]))return"";if(u&&u.type===b)return g(u.props.id,n,r,u.props.fields,u.props.plural,u.props.fallback)}return"string"==typeof u&&u.match(/\{\{/)&&(u=x(u,t)),u}function g(t,n,r,e,o,i){n&&(t=n+"."+t);var u=r&&a(r,t);return(o||0===o)&&u&&"object"==typeof u&&(u=u.splice?u[o]||u[0]:0===o&&f(u.none)?u.none:1===o&&f(u.one||u.singular)?u.one||u.singular:u.some||u.many||u.plural||u.other||u),u&&x(u,e,n,r)||i||null}function m(t){var n=t.value,r=t.id,e=p.useContext(c).intl;if(e&&e.mark){var o="dictionary"+(e&&e.scope?"."+e.scope:"")+"."+r;return l.h("mark",{style:{background:n?a(e,o)?"rgba(119,231,117,.5)":"rgba(229,226,41,.5)":"rgba(228,147,51,.5)"},title:r},n)}return n}function b(t){var n=t.id,r=t.children,e=t.plural,o=t.fields,i=p.useContext(c).intl,u=g(n,i&&i.scope,i&&i.dictionary,o,e,r);return l.h(m,{id:n,value:u})}function C(t,n,r){var e,o={};for(var i in n=n||{},t=d(t)){t.hasOwnProperty(i)&&t[i]&&(e=t[i],r||"string"!=typeof e?e.type===b&&(e=u({fallback:e.props.children},e.props),o[i]=g(e.id,n.scope,n.dictionary,e.fields,e.plural,e.fallback)):o[i]=g(e,n.scope,n.dictionary))}return o}function n(t){var n=t.children,r=p.useContext(c).intl;return n&&n.length?n.map(function(t){return l.cloneElement(t,C(t.props,r,!0))}):n&&l.cloneElement(n,C(n.props,r,!0))}function r(t){return l.h(n,null,l.h(k,{html:l.h(b,t),id:t.id}))}function k(t){var n=t.html,r=t.id,e=n?"string"==typeof n?l.h("span",{dangerouslySetInnerHTML:{__html:n}}):l.h("span",null,n):n;return l.h(m,{id:r,value:e})}function T(i){return function(o){function t(t,n){var r=p.useContext(c).intl,e=C("function"==typeof i?i(t,{intl:r}):i,r);return l.h(o,u(u({},t),e))}return t.getWrappedComponent=o&&o.getWrappedComponent||function(){return o},t}}function j(t){var n=p.useContext(c).intl;return C("function"==typeof t?t({intl:n}):t,n)}(o.intl=o).IntlContext=c,o.IntlProvider=e,o.Text=b,o.MarkupText=r,o.Localizer=n,o.withText=T,o.useText=j,exports.IntlContext=c,exports.IntlProvider=e,exports.Localizer=n,exports.MarkupText=r,exports.Text=b,exports.default=o,exports.intl=o,exports.useText=j,exports.withText=T;
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var l=require("preact"),a=require("preact/hooks"),p=t(require("dlv")),c=l.createContext({intl:{}});function f(t){return null!=t}function u(t,n){for(var r in n)t[r]=n[r];return t}function s(t,n){var r=u({},t);for(var e in n)n.hasOwnProperty(e)&&(t[e]&&n[e]&&"object"==typeof t[e]&&"object"==typeof n[e]?r[e]=s(t[e],n[e]):r[e]=t[e]||n[e]);return r}function d(t){if("string"==typeof(t=t||{})&&(t=t.split(",")),"join"in t){for(var n={},r=0;r<t.length;r++){var e=t[r].trim();e&&(n[e.split(".").pop()]=e)}return n}return t}function h(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&-1===n.indexOf(e)&&(r[e]=t[e]);return r}var v=/[?&#]intl=show/;function e(t){var n=t.scope,r=t.mark,e=t.definition,o=h(t,["scope","mark","definition"]),i=u({},a.useContext(c).intl||{});return n&&(i.scope=n),e&&(i.dictionary=s(i.dictionary||{},e)),(r||"undefined"!=typeof location&&String(location).match(v))&&(i.mark=!0),l.h(c.Provider,{value:{intl:i}},o.children)}function o(n,r){if(arguments.length<2)return r=n,function(t){return o(t,r)};function t(t){return l.h(e,r||{},l.h(n,t))}return t.getWrappedComponent=n&&n.getWrappedComponent||function(){return n},t}var i={};function x(t,n,r,e){return t&&t.replace(/\{\{([\w.-]+)\}\}/g,y.bind(null,n||i,r,e))}function y(t,n,r,e,o){for(var i=o.split("."),u=t,l=0;l<i.length;l++){if(null==(u=u[i[l]]))return"";if(u&&u.type===b)return g(u.props.id,n,r,u.props.fields,u.props.plural,u.props.fallback)}return"string"==typeof u&&u.match(/\{\{/)&&(u=x(u,t)),u}function g(t,n,r,e,o,i){n&&(t=n+"."+t);var u=r&&p(r,t);return(o||0===o)&&u&&"object"==typeof u&&(u=u.splice?u[o]||u[0]:0===o&&f(u.none)?u.none:1===o&&f(u.one||u.singular)?u.one||u.singular:u.some||u.many||u.plural||u.other||u),u&&x(u,e,n,r)||i||null}function m(t){var n=t.value,r=t.id,e=a.useContext(c).intl;if(e&&e.mark){var o="dictionary"+(e&&e.scope?"."+e.scope:"")+"."+r;return l.h("mark",{style:{background:n?p(e,o)?"rgba(119,231,117,.5)":"rgba(229,226,41,.5)":"rgba(228,147,51,.5)"},title:r},n)}return n}function b(t){var n=t.id,r=t.children,e=t.plural,o=t.fields,i=a.useContext(c).intl,u=g(n,i&&i.scope,i&&i.dictionary,o,e,r);return l.h(m,{id:n,value:u})}function C(t,n,r){var e,o={};for(var i in n=n||{},t=d(t)){t.hasOwnProperty(i)&&t[i]&&(e=t[i],r||"string"!=typeof e?e.type===b&&(e=u({fallback:e.props.children},e.props),o[i]=g(e.id,n.scope,n.dictionary,e.fields,e.plural,e.fallback)):o[i]=g(e,n.scope,n.dictionary))}return o}function n(t){var n=t.children,r=a.useContext(c).intl;return n&&n.length?n.map(function(t){return l.cloneElement(t,C(t.props,r,!0))}):n&&l.cloneElement(n,C(n.props,r,!0))}function r(t){return l.h(n,null,l.h(k,{html:l.h(b,t),id:t.id}))}function k(t){var n=t.html,r=t.id,e=n?"string"==typeof n?l.h("span",{dangerouslySetInnerHTML:{__html:n}}):l.h("span",null,n):n;return l.h(m,{id:r,value:e})}function T(i){return function(o){function t(t,n){var r=a.useContext(c).intl,e=C("function"==typeof i?i(t,{intl:r}):i,r);return l.h(o,u(u({},t),e))}return t.getWrappedComponent=o&&o.getWrappedComponent||function(){return o},t}}function j(t){var n=a.useContext(c).intl;return C("function"==typeof t?t({intl:n}):t,n)}(o.intl=o).IntlContext=c,o.IntlProvider=e,o.Text=b,o.MarkupText=r,o.Localizer=n,o.withText=T,o.useText=j,o.translate=g,exports.IntlContext=c,exports.IntlProvider=e,exports.Localizer=n,exports.MarkupText=r,exports.Text=b,exports.default=o,exports.intl=o,exports.translate=g,exports.useText=j,exports.withText=T;

@@ -1,1 +0,1 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact"),require("preact/hooks"),require("dlv")):"function"==typeof define&&define.amd?define(["exports","preact","preact/hooks","dlv"],t):t((n=n||self).preactLocalize={},n.preact,n.preactHooks,n.dlv)}(this,function(n,l,a,p){p=p&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p;var c=l.createContext({intl:{}});function f(n){return null!=n}function u(n,t){for(var e in t)n[e]=t[e];return n}var s=/[?&#]intl=show/;function r(n){var t=n.scope,e=n.mark,r=n.definition,o=function(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&-1===t.indexOf(r)&&(e[r]=n[r]);return e}(n,["scope","mark","definition"]),i=u({},a.useContext(c).intl||{});return t&&(i.scope=t),r&&(i.dictionary=function n(t,e){var r=u({},t);for(var o in e)e.hasOwnProperty(o)&&(t[o]&&e[o]&&"object"==typeof t[o]&&"object"==typeof e[o]?r[o]=n(t[o],e[o]):r[o]=t[o]||e[o]);return r}(i.dictionary||{},r)),(e||"undefined"!=typeof location&&String(location).match(s))&&(i.mark=!0),l.h(c.Provider,{value:{intl:i}},o.children)}function o(t,e){if(arguments.length<2)return e=t,function(n){return o(n,e)};function n(n){return l.h(r,e||{},l.h(t,n))}return n.getWrappedComponent=t&&t.getWrappedComponent||function(){return t},n}var i={};function d(n,t,e,r){return n&&n.replace(/\{\{([\w.-]+)\}\}/g,function(n,t,e,r,o){for(var i=o.split("."),u=n,l=0;l<i.length;l++){if(null==(u=u[i[l]]))return"";if(u&&u.type===y)return h(u.props.id,t,e,u.props.fields,u.props.plural,u.props.fallback)}"string"==typeof u&&u.match(/\{\{/)&&(u=d(u,n));return u}.bind(null,t||i,e,r))}function h(n,t,e,r,o,i){t&&(n=t+"."+n);var u=e&&p(e,n);return(o||0===o)&&u&&"object"==typeof u&&(u=u.splice?u[o]||u[0]:0===o&&f(u.none)?u.none:1===o&&f(u.one||u.singular)?u.one||u.singular:u.some||u.many||u.plural||u.other||u),u&&d(u,r,t,e)||i||null}function v(n){var t=n.value,e=n.id,r=a.useContext(c).intl;if(r&&r.mark){var o="dictionary"+(r&&r.scope?"."+r.scope:"")+"."+e;return l.h("mark",{style:{background:t?p(r,o)?"rgba(119,231,117,.5)":"rgba(229,226,41,.5)":"rgba(228,147,51,.5)"},title:e},t)}return t}function y(n){var t=n.id,e=n.children,r=n.plural,o=n.fields,i=a.useContext(c).intl,u=h(t,i&&i.scope,i&&i.dictionary,o,r,e);return l.h(v,{id:t,value:u})}function m(n,t,e){var r,o={};for(var i in t=t||{},n=function(n){if("string"==typeof(n=n||{})&&(n=n.split(",")),"join"in n){for(var t={},e=0;e<n.length;e++){var r=n[e].trim();r&&(t[r.split(".").pop()]=r)}return t}return n}(n)){n.hasOwnProperty(i)&&n[i]&&(r=n[i],e||"string"!=typeof r?r.type===y&&(r=u({fallback:r.props.children},r.props),o[i]=h(r.id,t.scope,t.dictionary,r.fields,r.plural,r.fallback)):o[i]=h(r,t.scope,t.dictionary))}return o}function t(n){var t=n.children,e=a.useContext(c).intl;return t&&t.length?t.map(function(n){return l.cloneElement(n,m(n.props,e,!0))}):t&&l.cloneElement(t,m(t.props,e,!0))}function e(n){return l.h(t,null,l.h(g,{html:l.h(y,n),id:n.id}))}function g(n){var t=n.html,e=n.id,r=t?"string"==typeof t?l.h("span",{dangerouslySetInnerHTML:{__html:t}}):l.h("span",null,t):t;return l.h(v,{id:e,value:r})}function x(i){return function(o){function n(n,t){var e=a.useContext(c).intl,r=m("function"==typeof i?i(n,{intl:e}):i,e);return l.h(o,u(u({},n),r))}return n.getWrappedComponent=o&&o.getWrappedComponent||function(){return o},n}}function b(n){var t=a.useContext(c).intl;return m("function"==typeof n?n({intl:t}):n,t)}(o.intl=o).IntlContext=c,o.IntlProvider=r,o.Text=y,o.MarkupText=e,o.Localizer=t,o.withText=x,o.useText=b,n.IntlContext=c,n.IntlProvider=r,n.Localizer=t,n.MarkupText=e,n.Text=y,n.default=o,n.intl=o,n.useText=b,n.withText=x,Object.defineProperty(n,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("preact"),require("preact/hooks"),require("dlv")):"function"==typeof define&&define.amd?define(["exports","preact","preact/hooks","dlv"],n):n((t=t||self).preactLocalize={},t.preact,t.preactHooks,t.dlv)}(this,function(t,l,a,p){p=p&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p;var c=l.createContext({intl:{}});function f(t){return null!=t}function u(t,n){for(var e in n)t[e]=n[e];return t}var s=/[?&#]intl=show/;function r(t){var n=t.scope,e=t.mark,r=t.definition,o=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&-1===n.indexOf(r)&&(e[r]=t[r]);return e}(t,["scope","mark","definition"]),i=u({},a.useContext(c).intl||{});return n&&(i.scope=n),r&&(i.dictionary=function t(n,e){var r=u({},n);for(var o in e)e.hasOwnProperty(o)&&(n[o]&&e[o]&&"object"==typeof n[o]&&"object"==typeof e[o]?r[o]=t(n[o],e[o]):r[o]=n[o]||e[o]);return r}(i.dictionary||{},r)),(e||"undefined"!=typeof location&&String(location).match(s))&&(i.mark=!0),l.h(c.Provider,{value:{intl:i}},o.children)}function o(n,e){if(arguments.length<2)return e=n,function(t){return o(t,e)};function t(t){return l.h(r,e||{},l.h(n,t))}return t.getWrappedComponent=n&&n.getWrappedComponent||function(){return n},t}var i={};function d(t,n,e,r){return t&&t.replace(/\{\{([\w.-]+)\}\}/g,function(t,n,e,r,o){for(var i=o.split("."),u=t,l=0;l<i.length;l++){if(null==(u=u[i[l]]))return"";if(u&&u.type===y)return h(u.props.id,n,e,u.props.fields,u.props.plural,u.props.fallback)}"string"==typeof u&&u.match(/\{\{/)&&(u=d(u,t));return u}.bind(null,n||i,e,r))}function h(t,n,e,r,o,i){n&&(t=n+"."+t);var u=e&&p(e,t);return(o||0===o)&&u&&"object"==typeof u&&(u=u.splice?u[o]||u[0]:0===o&&f(u.none)?u.none:1===o&&f(u.one||u.singular)?u.one||u.singular:u.some||u.many||u.plural||u.other||u),u&&d(u,r,n,e)||i||null}function v(t){var n=t.value,e=t.id,r=a.useContext(c).intl;if(r&&r.mark){var o="dictionary"+(r&&r.scope?"."+r.scope:"")+"."+e;return l.h("mark",{style:{background:n?p(r,o)?"rgba(119,231,117,.5)":"rgba(229,226,41,.5)":"rgba(228,147,51,.5)"},title:e},n)}return n}function y(t){var n=t.id,e=t.children,r=t.plural,o=t.fields,i=a.useContext(c).intl,u=h(n,i&&i.scope,i&&i.dictionary,o,r,e);return l.h(v,{id:n,value:u})}function m(t,n,e){var r,o={};for(var i in n=n||{},t=function(t){if("string"==typeof(t=t||{})&&(t=t.split(",")),"join"in t){for(var n={},e=0;e<t.length;e++){var r=t[e].trim();r&&(n[r.split(".").pop()]=r)}return n}return t}(t)){t.hasOwnProperty(i)&&t[i]&&(r=t[i],e||"string"!=typeof r?r.type===y&&(r=u({fallback:r.props.children},r.props),o[i]=h(r.id,n.scope,n.dictionary,r.fields,r.plural,r.fallback)):o[i]=h(r,n.scope,n.dictionary))}return o}function n(t){var n=t.children,e=a.useContext(c).intl;return n&&n.length?n.map(function(t){return l.cloneElement(t,m(t.props,e,!0))}):n&&l.cloneElement(n,m(n.props,e,!0))}function e(t){return l.h(n,null,l.h(g,{html:l.h(y,t),id:t.id}))}function g(t){var n=t.html,e=t.id,r=n?"string"==typeof n?l.h("span",{dangerouslySetInnerHTML:{__html:n}}):l.h("span",null,n):n;return l.h(v,{id:e,value:r})}function x(i){return function(o){function t(t,n){var e=a.useContext(c).intl,r=m("function"==typeof i?i(t,{intl:e}):i,e);return l.h(o,u(u({},t),r))}return t.getWrappedComponent=o&&o.getWrappedComponent||function(){return o},t}}function b(t){var n=a.useContext(c).intl;return m("function"==typeof t?t({intl:n}):t,n)}(o.intl=o).IntlContext=c,o.IntlProvider=r,o.Text=y,o.MarkupText=e,o.Localizer=n,o.withText=x,o.useText=b,o.translate=h,t.IntlContext=c,t.IntlProvider=r,t.Localizer=n,t.MarkupText=e,t.Text=y,t.default=o,t.intl=o,t.translate=h,t.useText=b,t.withText=x,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "preact-i18n",
"amdName": "preactLocalize",
"version": "2.2.0-preactx",
"version": "2.3.0-preactx",
"description": "Preact internationalization, done simply.",

@@ -6,0 +6,0 @@ "source": "src/index.js",

@@ -159,2 +159,4 @@ # preact-i18n 🌎 [![npm](https://img.shields.io/npm/v/preact-i18n.svg?style=flat)](https://npm.im/preact-i18n) [![travis](https://travis-ci.org/synacor/preact-i18n.svg?branch=preactX)](https://travis-ci.org/synacor/preact-i18n) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsynacor%2Fpreact-i18n.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsynacor%2Fpreact-i18n?ref=badge_shield)

- [Parameters](#parameters-6)
- [translate](#translate)
- [Parameters](#parameters-7)

@@ -435,4 +437,21 @@ ### IntlProvider

### translate
Attempts to look up a translated value from a given dictionary.
Also supports json templating using the format: {{variable}}
Falls back to default text.
#### Parameters
- `id` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Intl field name/id (subject to scope)
- `scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Scope, which prefixes `id` with `${scope}.` (optional, default `''`)
- `dictionary` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A nested object containing translations
- `fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Template fields for use by translated strings (optional, default `{}`)
- `plural` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Indicates a quantity, used to trigger pluralization
- `fallback` **([String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))?** Text to return if no translation is found
Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** translated
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsynacor%2Fpreact-i18n.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsynacor%2Fpreact-i18n?ref=badge_large)

@@ -9,4 +9,5 @@ import { intl } from './intl';

import { useText } from './hooks/use-text';
import translate from './lib/translate';
export { intl, IntlContext, IntlProvider, Text, MarkupText, Localizer, withText, useText };
export { intl, IntlContext, IntlProvider, Text, MarkupText, Localizer, withText, useText, translate };

@@ -21,2 +22,4 @@ intl.intl = intl;

intl.useText = useText;
intl.translate = translate;
export default intl;

@@ -7,12 +7,11 @@ import delve from 'dlv';

* Also supports json templating using the format: {{variable}}
* Falls back to default text.
* Falls back to default text.
*
* @private
* @param {String} id Intl field name/id (subject to scope)
* @param {String} [scope=''] Scope, which prefixes `id` with `${scope}.`
* @param {Object} dictionary A nested object containing translations
* @param {Object} [fields={}] Template fields for use by translated strings
* @param {Number} [plural] Indicates a quantity, used to trigger pluralization
* @param {String|Array} [fallback] Text to return if no translation is found
* @returns {String} translated
* @param {String} id Intl field name/id (subject to scope)
* @param {String} [scope=''] Scope, which prefixes `id` with `${scope}.`
* @param {Object} dictionary A nested object containing translations
* @param {Object} [fields={}] Template fields for use by translated strings
* @param {Number} [plural] Indicates a quantity, used to trigger pluralization
* @param {String|Array} [fallback] Text to return if no translation is found
* @returns {String} translated
*/

@@ -19,0 +18,0 @@ export default function translate(id, scope, dictionary, fields, plural, fallback) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc