Socket
Socket
Sign inDemoInstall

@automattic/babel-plugin-i18n-calypso

Package Overview
Dependencies
64
Maintainers
40
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

4

package.json
{
"name": "@automattic/babel-plugin-i18n-calypso",
"version": "1.1.1",
"version": "1.2.0",
"description": "A Babel plugin to generate a POT file for translate calls",

@@ -24,3 +24,3 @@ "main": "src/index.js",

"license": "GPL-2.0-or-later",
"gitHead": "d2e6d7e0b02619f09de68f11bb24f86f8aca8b76"
"gitHead": "aaa8f0cf8a2a8a1b61d2a57506c465d0743b6a72"
}

@@ -192,2 +192,31 @@ /**

/**
* Merge the properties of extracted string objects.
*
* @param {object} source left-hand string object
* @param {object} target right-hand string object
*
* @returns {void}
*/
function mergeStrings( source, target ) {
if ( ! source.comments.reference.includes( target.comments.reference ) ) {
source.comments.reference += '\n' + target.comments.reference;
}
if ( ! source.comments.extracted ) {
source.comments.extracted = target.comments.extracted;
} else if (
target.comments.extracted &&
! source.comments.extracted.includes( target.comments.extracted )
) {
source.comments.extracted += '\n' + target.comments.extracted;
}
// A previous singular string matches a plural string. In PO files those are merged.
if ( ! source.hasOwnProperty( 'msgid_plural' ) && target.hasOwnProperty( 'msgid_plural' ) ) {
source.msgid_plural = target.msgid_plural;
source.msgstr = target.msgstr;
}
}
module.exports = function () {

@@ -321,8 +350,4 @@ let strings = {},

strings[ msgctxt ][ msgid ] = translation;
} else if (
! strings[ msgctxt ][ msgid ].comments.reference.includes(
translation.comments.reference
)
) {
strings[ msgctxt ][ msgid ].comments.reference += '\n' + translation.comments.reference;
} else {
mergeStrings( strings[ msgctxt ][ msgid ], translation );
}

@@ -329,0 +354,0 @@ },

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