New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dfx-translate

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dfx-translate - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

8

package.json
{
"name": "dfx-translate",
"version": "1.3.0",
"version": "1.3.1",
"private": false,

@@ -28,2 +28,8 @@ "license": "MIT",

},
"bin": {
"generateTranslation": "translation/generateTranslation.js",
"generateTranslationType": "translation/generateTranslationKeys.js",
"resetTranslationType": "translation/resetTranslationKeys.js"
},
"type": "module",
"repository": {

@@ -30,0 +36,0 @@ "type": "git",

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

#!/usr/bin/env node
/**

@@ -2,0 +3,0 @@ * Credits go to https://github.com/qunabu/translate-script.

21

translation/generateTranslationKeys.js

@@ -0,14 +1,11 @@

#!/usr/bin/env node
/**
* Credits go to https://github.com/qunabu/translate-script.
* Adds compatibility to LibreTranslation API
* Adds cache feature
* Adds check against manual written language files in /src/assets/i18n/{target}.json
* Generates translations key type which will provide type-safe auto-completion for your ide.
*
* Command syntax:
* node ./node_modules/dfx-translate/translation/generateTranslation.js {API_URL} {INPUT_LANG} {TARGET_LANG}
* node ./node_modules/dfx-translate/translation/generateTranslationKeys.js {INPUT_LANG_PATH}
*
* Command examples:
* node ./node_modules/dfx-translate/translation/generateTranslation.js https://translate.abc.abc/translate de en
* node ./node_modules/dfx-translate/translation/generateTranslation.js https://translate.abc.abc/translate de fr
* node ./node_modules/dfx-translate/translation/generateTranslation.js https://translate.abc.abc/translate de es
* Command example:
* node ./node_modules/dfx-translate/translation/generateTranslation.js ./src/assets/i18n/de.json
*/

@@ -18,3 +15,3 @@

const INPUT_LANG = process.argv[3] || 'de';
const INPUT_LANG_PATH = process.argv[2];

@@ -79,7 +76,7 @@ /**

getJSON('./src/assets/i18n/' + INPUT_LANG + '.json') // get data from input file
getJSON(INPUT_LANG_PATH) // get data from input file
.then((input_vars) => convertToArray(input_vars)) // convert data from object to array
.then((input_arr) => processTranslation(input_arr)) // process the whole array
.then((keystring) => writeToFile('./node_modules/dfx-translate/lib/translationKeys.d.ts', keystring)) // saves translated object into file
.then((keystring) => writeToFile('./node_modules/dfx-translate/lib/translationKeys.d.ts', keystring))
.then((filename) => console.log(`translation successfully saved in ${filename}`)) // outputs success
.catch((err) => console.error('Error', err)); // shows error in case above fails

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

#!/usr/bin/env node
/**
* Resets the translations key type which will provide type-safe auto-completion for your ide.
*/
import fs from 'fs'; // eslint-disable-line

@@ -2,0 +8,0 @@

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