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

jsdoc-i18n

v0.1.1

Published

A internationlization workflow developed around JSDoc

Downloads

9

Readme

jsdoc-i18n

jsdoc-i18n is an internationalization workflow developed around the jsdoc documentation tool.

What this means exactly is:

  • you can export jsdoc data into an intermediate database
  • you can use the built in tool to create multiple translations of each jsdoc item
  • you can render these language variations into separate language folders

Also we really tried to make jsdoc-i18n an extension of the existing jsdoc tool, giving it a relatively small footprint. This means that the jsdoc configuration system, all existing jsdoc arguments, as well as existing jsdoc templates (with very minor patching) are supported.

Installation

To install jsdoc-i18n globally

npm install -g jsdoc-i18n

To add jsdoc-i18n as a dependency to you project

npm install --save jsdoc-i18n

Configuration

On top of the existing jsdoc configuration options, the following options are accepted under the i18n rootpath:

  • defaultLang: The default language existing documentation is written in (Default: en)
  • possibleLang: List of languages we can translate to (Default: ['zh', 'es', 'ja'])
  • dbPlugin: The jsdoc-i18n database plugin to be used when saving or retrieving jsdoc data. This can be either a filename or a string reference to one of the jsdoc-i18n internal database plugins (Default: file)
  • dbFilePath: Path to database json files for jsdoc-i18n internal database file plugin (Default: ./i18n)
  • serverPort: Port on which jsdoc-i18n translation web application tool should listen (Default: 8080)
  • serverCheckPaths: Paths which jsdoc-i18n translation web application tool tool check when a request is made (Default: ['.', 'index.html', 'index.htm'])

NOTE:
Currently these options cannot be set via command line. Therefore the configuration file argument is required for jsdoc-i18n to function properly.

Usage

To import jsdoc data to jsdoc-i18n database:
(Supports jsdoc arguments)

jsdoc-i18n-import -c path/to/your/conf.json path/to/files/to/be/parsed

To start jsdoc-i18n translation web application tool:
(http://localhost:8080)

jsdoc-i18n-server -c path/to/your/conf.json

To render data from jsdoc-i18n database with given language
(Supports jsdoc arguments)

jsdoc-i18n-render -c path/to/your/conf.json -l <language>

Caveats

  • Due to an issues in jsdoc ES6 class definitions cannot be inlined with export statements.
    For example you cannot define an ES6 class like such:

      export default class SomeClass {
      }

    Instead you will have to break the definition over 2 lines:

      class SomeClass {
      }
    
      export default SomeClass;
  • Due to the way jdodc-i18n works, you cannot document a class and it's constructor separately.
    For example you cannot document an ES6 class like such:

      /**
       * @extends EventEmitter
       */
      class SomeClass extends EventEmitter {
        /**
         * @param {*} a - what a is for
         * @param {*} b - what b is for
         */
    	   constructor(a, b) {
        }
      }

    Instead you should put the constructor documentation inside the class documentation:

      /**
       * @extends EventEmitter
       * @param {*} a - what a is for
       * @param {*} b - what b is for
       */
      class SomeClass extends EventEmitter {
    	   constructor(a, b) {
        }
      }

License

jsdoc-i18n is free software, licensed under the MIT License.
See the LICENSE.md file in this repository for more details.