Coder Social home page Coder Social logo

gettext.js's Introduction

Build Status

Documentation Status

gettext.js

gettext.js provides a GNU gettext like interface for use in browsers, a MO file to JS transpiler and a webpack loader for MO files.

Full Docs: http://gettextjs.readthedocs.org/

Usage

Webpack

import English from 'locales/en/LC_MESSAGES/messages.mo';

English.gettext('hello world');
English.ngettext('bug', 'bugs', 4);

Runtime

import {gettext as _, ngettext, set_catalog} from "gettextjs";

set_catalog(...);

_("hello world");
ngettext("bug", "bugs", 4);

Compile

gettextjs <input> <output> turns the input MO file int a JS file.

gettext.js's People

Contributors

ojii avatar dimaqq avatar

Stargazers

 avatar Marcelo Piva avatar Brett Jankord avatar Junichi SHINOHARA avatar Eugene Manuilov avatar Kevin O'Neil avatar Hiroki Kiyohara avatar Kazuhiro Ogura avatar

Watchers

James Cloos avatar  avatar

Forkers

adamchainz

gettext.js's Issues

Add `export gettext = <func>`

Currently the module only has a default export, which means it can be used like so:

import gettext from "gettextjs";

xxx = gettext.gettext("Translate me");

If it also had a named exports, it could be used like this:

import {gettext, ngettext} from "gettextjs";

xxx = gettext("Translate me");

And eventually with an alias:

import {gettext as _, ngettext} from "gettextjs";

xxx = _("Translate me");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.