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

narp

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

narp

The worlds best super translation manager package handler

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
increased by3200%
Maintainers
1
Weekly downloads
 
Created
Source

narp narp

A workflow utility to ease localization in JS(X) apps by automizing the following steps:

narp push

  1. Extraction of strings from source code (react-gettext-parser)
  2. Merging upstream and local translations in order to support translations in branches (pot-merge)
  3. Uploading POT resources to Transifex

narp pull

  1. Download PO translations from Transifex
  2. Converting PO to JSON (gettext-parser)
  3. Writing the JSON translations to where you want it

The JSON translations are formatted for node-gettext, so using this as the gettext frameform is a really good idea. :)

Installation

To use it easily, install narp globally with:

npm install -g narp

To use it in an automatization pipeline in your project, install it as a dev dependency:

npm install --save-dev narp

Usage

Using the CLI

# get help
narp -h
# extract + merge pots + upload pot
node push --password MY_TRANSIFEX_PASS
# download po's + convert to json + write to file
node pull --password MY_TRANSIFEX_PASS

--password is also available as -p.

Using the API

import { push, pull } from 'narp';

const configs = {
  transifex: {
    password: 'retrieve this somehow, don\'t check it in'
  },
};

push(configs);

pull(configs);

Configuration in .narprc

.narprc is narp's configuration file. There you specify configs for the different tasks that require so.

You only need to specify the configs that you want to overwrite.

The defaults are:

{
  "transifex": {
    "username": null,
    "project": null,
    "resource": null,
    "sourceLang": "en"
  },
  
  // Configs that are passed to react-gettext-parser
  "extract": {
  
    // A glob string (npmjs.com/glob) that matches all source files
    // that may contain translatable strings.
    "source": null,
    
    // These two are passed directly to react-gettext-parser,
    // see the react-gettext-parser readme
    "componentPropsMap": { /* react-gettext-parser defaults */ },
    "funcArgumentsMap": { /* react-gettext-parser defaults */ }
  },
  
  // Where to put all the translations
  "output": "messages.json"
}

Development

Creating builds

# Create a build from source
npm run build

# Build continuously as you save files
npm run build -- --watch

Making it globally available while testing

cd path/to/narp && npm link

Releases

Follow semver when bumping the version number, commit it and run

npm publish

FAQs

Package last updated on 22 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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