Socket
Socket
Sign inDemoInstall

@wordpress/i18n

Package Overview
Dependencies
12
Maintainers
7
Versions
146
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

5

build-module/index.js

@@ -51,3 +51,3 @@ /**

export function getI18n() {
function getI18n() {
if (!i18n) {

@@ -74,3 +74,4 @@ setLocaleData();

export var dcnpgettext = memoize(function () {
var dcnpgettext = memoize(function () {
var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

@@ -77,0 +78,0 @@ var context = arguments.length > 1 ? arguments[1] : undefined;

4

build/index.js

@@ -9,3 +9,2 @@ "use strict";

exports.setLocaleData = setLocaleData;
exports.getI18n = getI18n;
exports.__ = __;

@@ -16,3 +15,2 @@ exports._x = _x;

exports.sprintf = sprintf;
exports.dcnpgettext = void 0;

@@ -120,4 +118,2 @@ var _jed = _interopRequireDefault(require("jed"));

exports.dcnpgettext = dcnpgettext;
function __(text, domain) {

@@ -124,0 +120,0 @@ return dcnpgettext(domain, undefined, text);

@@ -1,3 +0,10 @@

## 2.0.0 (Unreleased)
## 3.0.0 (Unreleased)
### Braking Change
- `wp.i18n.getI18n` has been removed. Use `__`, `_x`, `_n`, or `_nx` instead.
- `wp.i18n.dcnpgettext` has been removed. Use `__`, `_x`, `_n`, or `_nx` instead.
## 2.0.0 (2018-09-05)
### Breaking Change

@@ -4,0 +11,0 @@

{
"name": "@wordpress/i18n",
"version": "2.0.0",
"version": "3.0.0",
"description": "WordPress internationalization (i18n) library.",

@@ -21,2 +21,3 @@ "author": "The WordPress Contributors",

"module": "build-module/index.js",
"react-native": "src/index",
"bin": {

@@ -27,2 +28,3 @@ "pot-to-php": "./tools/pot-to-php.js"

"@babel/runtime": "^7.0.0",
"@wordpress/deprecated": "^2.0.1",
"gettext-parser": "^1.3.1",

@@ -39,3 +41,3 @@ "jed": "^1.1.1",

},
"gitHead": "df6f8da7b557894e4364c17db2dd4af0d1e20252"
"gitHead": "7b17d5777076896fb25170b23d6e83e8c049240d"
}

@@ -74,8 +74,2 @@ # Internationalization (i18n)

`getI18n(): Jed`
Returns the current Jed instance, initializing with a default configuration if not already assigned.
See: http://messageformat.github.io/Jed/
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>

@@ -50,3 +50,3 @@ /**

*/
export function getI18n() {
function getI18n() {
if ( ! i18n ) {

@@ -73,3 +73,3 @@ setLocaleData();

*/
export const dcnpgettext = memoize( ( domain = 'default', context, single, plural, number ) => {
const dcnpgettext = memoize( ( domain = 'default', context, single, plural, number ) => {
try {

@@ -76,0 +76,0 @@ return getI18n().dcnpgettext( domain, context, single, plural, number );

/**
* Internal dependencies
*/
import { dcnpgettext, sprintf, __, _x, _n, _nx, setLocaleData } from '../';
import { sprintf, __, _x, _n, _nx, setLocaleData } from '../';

@@ -37,9 +37,22 @@ // Mock memoization as identity function. Inline since Jest errors on out-of-

describe( 'i18n', () => {
describe( 'dcnpgettext()', () => {
it( 'absorbs errors', () => {
const result = dcnpgettext( 'domain-without-data', undefined, 'Hello' );
describe( 'error absorb', () => {
it( '__', () => {
__( 'Hello', 'domain-without-data' );
expect( console ).toHaveErrored();
} );
it( '_x', () => {
_x( 'feed', 'verb', 'domain-without-data' );
expect( console ).toHaveErrored();
expect( result ).toBe( 'Hello' );
} );
it( '_n', () => {
_n( '%d banana', '%d bananas', 3, 'domain-without-data' );
expect( console ).toHaveErrored();
} );
it( '_nx', () => {
_nx( '%d apple', '%d apples', 3, 'fruit', 'domain-without-data' );
expect( console ).toHaveErrored();
} );
} );

@@ -46,0 +59,0 @@

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc