Socket
Socket
Sign inDemoInstall

c-3po

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c-3po

[![travis](https://api.travis-ci.org/c-3po-org/c-3po.svg?master)](https://travis-ci.org/c-3po-org/c-3po) [![codecov](https://codecov.io/gh/c-3po-org/c-3po/branch/master/graph/badge.svg)](https://codecov.io/gh/c-3po-org/c-3po)


Version published
Weekly downloads
19
increased by18.75%
Maintainers
1
Weekly downloads
 
Created
Source

c-3po

travis codecov

NPM

Modern javascript i18n localization library based on es6 tagged templates and the good old GNU gettext

Key features

  • Uses es6 template literals for string formatting (no need for sprintf).
  • Can precompile translations on a build step.
  • Uses babel plugin to extract and resolve translations, works with modern javascript AST.
  • Can be integrated in any build tool that works with babel.
  • Has options for both efficient development and production setups.
  • Has a builtin validation for translated strings format.
  • Can use any default locale in sources (not only English).
  • Handles React (jsx) translations.

Usage example

import { t, ngettext, msgid } from 'c-3po'

// formatted strings
const name = 'Mike';
const helloMike = t`Hello ${name}`;

// plurals (works for en locale out of the box)
const n = 5;
const msg = ngettext(msgid`${ n } task left`, `${ n } tasks left`, n)

Installation

npm install --save c-3po
npm install --save-dev babel-plugin-c-3po

c-3po babel plugin - https://github.com/c-3po-org/babel-plugin-c-3po

Usage from CDN

https://unpkg.com/c-3po/dist/c3po.min.js

This project is designed to work in pair with babel-plugin-c-3po But you can also play with it without transpile. Here is the doc about how to use c-3po without babel transpilation.

Tutorials

Slides from talks

Quick view on Jsfiddle playground - https://jsfiddle.net/AlexMost/9wuafbL5/11/

Keywords

FAQs

Package last updated on 16 May 2017

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