New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@valueadd/translations-finder

Package Overview
Dependencies
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@valueadd/translations-finder

The tool which will help you to find missing translations

  • 2.8.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-93.75%
Maintainers
6
Weekly downloads
 
Created
Source

Translations Finder

Finds missing translations in your project.

Installation

Install with npm

# Locally
npm i translations-finder

# Globally
npm i -g translations-finder

Usage

import { findMissingTranslations } from "translations-finder";

const missingTranslations = findMissingTranslations(
  definedTranslations,
  globFilePattern,
  regexTranslation,
  regexTranslationKey,
  directory
);

definedTranslations is an object of keys assigned to translations.

{
  common: {
    login: "Login",
    logout: "Logout",
    menu: {
      title: "The Boring Company"
    }
  }
}

globFilePattern is the glob matcher for files.

"{,!(node_modules)/**/}*.html";

regexTransaltion is a regular expression that is supposed to match the translation key or the text that includes the translation key.

// Matches {{ 'common.author' | translate }}
/('+[A-Za-z]+\.[A-Za-z]+')( \| translate)/g;

regexTranslationKey is a an optional parameter which can be used to extract the actual key from the found text.

// Extracts the key common.author from the previous matching.
/([A-Za-z]+(\.[A-Za-z]+)+)+/g;

directory is an optional parameter that is used as a root directory to search in. When not provided, the value is equal to process.cwt().

Example usage

import { findMissingTranslations } from "translations-finder";

preparedTranslations = {
  common: {
    login: "Login",
    logout: "Logout",
    menu: {
      title: "The Boring Company",
    },
  },
};

const missingTranslations = findMissingTranslations(
  preparedTranslations,
  "{,!(node_modules)/**/}*.html",
  /('+[A-Za-z]+\.[A-Za-z]+')( \| translate)/g,
  /([A-Za-z]+(\.[A-Za-z]+)+)+/g
);

Keywords

FAQs

Package last updated on 18 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc