npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auto-translator

v0.1.0

Published

Trasnlates angular code around from translation json files back to JS so you can work on your translations easily

Downloads

3

Readme

Angular-Auto-Translate

Translating multiple languages in Angular through JSON seamlessly

We use this at TipRanks internally, anyone who wants to read the code have a go - but this is for internal use and we do not intend to provide support any external users. Pull requests will be entertained if accompanied by tests.

###What this does

This package is meant for processing multiple languages in Angular. Translation files are stored in JSON and the script uses esprima/escodegen or cheerio to swap the file content with the relevant translation.

Translating is hard and working with foreign JSON files isn't fun, especially when you need to debug how something looks in a foreign language and you end up going back and forth between JSON translations and HTML files.

This solves that problem.

For example, you can take:

var foo = translated("greeting","Hello!");

Run this with fileToJson and lang=en and get

{"greeting":{"en": "Hello!"}

Then have a translator write the same text in German, getting

{"greeting":{"en": "Hello!","de":"Hallo!"}

Now, if you want to build or debug the german version, you can run the code with the jsonToFile option and get:

var foo = translated("greeting","Hallo!");

When you're done working on it, you can push it back to the json and load another version. This also has the advantage that translation is a build step and there is no performance overhead in having a translated site.

The HTML syntax is <tr-translated="greeting">Hello</tr-translated> and does the same thing.

###Usage

Generating or updating the JSON from an HTML or JS file:

node translator.js  --source=YOURJSOrHTMLSourceFile --json=YOURJSON.json --lang=en --dir=fileToJson

Updating the HTML or JS file with JSON

node translator.js  --source=YOURJSOrHTMLSourceFile --json=YOURJSON.json --lang=en --dir=fileToJson

###Running tests

Run the tests using mocha tests.

Users may use it under the MIT license.