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

intl-utils

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-utils

Utilities for internationalization

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

intl-utils

This is an utility for internationalization of applications.

An example with NextJS will be as follows:

import withRouter, { WithRouterProps } from 'next/dist/client/with-router';
import buildTranslateFunction from 'intl-utils';

import translations from './translations';

function HomePage(props: WithRouterProps) {
  const t = buildTranslateFunction(translations, props.router.locale);

  return <p>{t('Hello World')}</p>
}

export default withRouter(HomePage);

Where translations.js is as follows:

/* spellchecker: disable */
module.exports = {
  "es": {
    "Hello World": "Hola mundo"
  },
  "fr": {
    "Hello World": "Bonjour le monde"
  },
  "it": {
    "Hello World": "Ciao mondo"
  },
  "pt": {
    "Hello World": "Olá, mundo"
  }
}

The structure of the file is:

module.exports = {
  LOCALE: {
    KEY: TRANSLATED_KEY
  }
}

Where TRANSLATED_KEY is the translation of KEY on LOCALE

Please note that intl-utils-aws-translate can help you to automatically generate the translation files using AWS Translate.

Release Process

  • Commit your changes
  • Test your changes npm test
  • Adjust the version, e.g.: npm version patch
  • Build npm run build
  • Publish npm publish
  • Push the changes e.g. git push --tags && git push
  • Create the release in Github

Keywords

FAQs

Package last updated on 24 Jun 2023

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