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

@translation-summary/core

v1.1.1

Published

View a summary of missing translation files into a folder

Downloads

33

Readme

TranslationSummaryJS

View a summary of missing translation files into a folder

This library will help you to find missing translation files into a folder docs

Output

How to use

Install

npm i @translation-summary/core -g

Create translation-summary-config.js file. You can config just the properties witch you need.

module.exports = {
    folderPath: './i18n',
    filePattern: '_...md$',
    filePatternForReplace: '_LANGUAGE.md',
    fileExtension: '.md',
    extractLanguage: (file) => {
        return file.substring(file.length - 5, file.length - 3);
    },
    replaceExtension: (file, lang, pattern, fileExtension) => {
        return file.replace(fileExtension, pattern.replace('LANGUAGE', lang));
    },
};

Note: visit Avaliables options for more information

Run ts command

translation-summary --config translation-summary-config.js

or just

ts -c translation-summary-config.js

Install plugin into your proyect

node (JS)

const ts = require('@translation-summary/core');

const helper = new ts.TranslationSummary();
const summary = helper.getSummary();

console.table(summary);

Show data in console

import { TranslationSummary } from './translation-summay';

const helper = new TranslationSummary();
const summary = helper.getSummary();

console.table(summary);

Result model

export interface FileSummary {
    file: string;
    [key: string]: string;
}

Options

You can define options for files, extensions and replace functions that the library need it.

const options = new Options();

options.folderPath = './docs';
options.filePattern = '_...md$';
options.filePatternForReplace = '_param.md';
options.fileExtension = '.md';
options.extractLanguage = (file: string): string => {
    return file.substring(file.length - 5, file.length - 3);
};
options.replaceExtension = (file: string, lang: string, pattern: string, fileExtension: string): string => {
    return file.replace(fileExtension, pattern.replace('param', lang));
};

const helper = new TranslationSummary(options);
const summary = helper.getSummary();

Avaliables options

| Option | Description | Default | | -------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------- | | folderPath | Folder where start to search docs files | ./docs | | filePattern | Regular expression as string used to find native files | _...md$ | | filePatternForReplace | Regular expression with a param string witch will be replaced be language key | _param.md | | fileExtension | File extension for docs files (empty string will take all files) | .md | | extractLanguage | Function that return a language from a filename (e: doc_en.md must return en) | | | replaceExtension | Function that replace a native filename for a especific language filename (e: doc.md must return doc_en.d) | |

Troubleshooting

Some libraries may you need to install globably

ts-node

npm i ts-node -g

tsutils

npm i tsutils -g

typescript

npm i typescript -g

Fundind

Invitame un café en cafecito.app

Buy me a coffee

Support me on Ko-fi