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

grunt-i18n

v0.7.0

Published

Internationalization and translation of templates.

Downloads

537

Readme

grunt-i18n Build Status

Internationalization support for grunt.

Getting started

This plugin requires Grunt ~0.4.0

Please note this is a coffeescript task and the sources are located in src folder, javascript is generated.

i18n task

Run this task with the grunt i18n command. Task targets, files and options may be specified according to the grunt Configuring tasks guide.

This plugin provides a localization mechanism for grunt templates. It was developed as a tool for localizing AngularJS templates during a grunt build process. Since localization is done once during the build there is no performance hit on the application, as oppose to dynamic localization.

Usage example

Please check the test as they demonstrate the usage pretty well. In short you need localization files and a HTML template/s. As an output you get one translated HTML template/s per localization file.

Options

Available options to configure the task.

locales

Type: String|Array

Path to localization files. Please check the examples in tests. Glob patterns can be used. JSON or YAML format is allowed, /(.yaml|.yml)$/ otherwise it's JSON.

output

Type: String

Root output folder.

base

Type: String

Base folder for HTML templates which should not be preserved while translating. Please check the tests if you don't get it ;)

delimiters

Type: String

Custom delimiters name to be used instead of the default <% %>. See the grunt.template documentation for more details.

format

Type: String

Supports 'json', 'yaml', 'transifex', 'properties'.

Locales from Transifex have all their translations below one root property, the name of the translation:

{
  "en_US": {
    "message": "Hello world!",
    "nested": {
      "msg": "and hello to you"
    }
  }
}

parser

Type: Object

Custom parser to read locale files. There are 2 functions which have to be provided:

  • resolveLocale: (localePath) -> locale - get locale from locale path
  • readLocaleData: (localePath) -> data - read locale file

For example check src/parsers.coffee

Release History

  • 2013-11-11   v0.7.0   Properties parser. Custom parsers
  • 2013-12-31   v0.6.0   Transifex locale format added
  • 2013-12-06   v0.5.0   Can read locals in yaml format
  • 2013-11-29   v0.4.0   Custom delimiters and localization file existence checks
  • 2013-10-23   v0.3.0   Fix for separator in output path. Add logging messages
  • 2013-10-22   v0.2.0   Might be useful for others
  • 2013-05-28   v0.1.0   Initial release, not really useful for anybody except me ;)