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

i18next-v4-format-converter

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-v4-format-converter

This package helps to convert old i18next translation resources to the new i18next v4 json format.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2K
decreased by-46.53%
Maintainers
2
Weekly downloads
 
Created
Source

Introduction

Actions Actions deno npm version

This package helps to convert old i18next translation resources to the new i18next v4 json format. (It will only handle keys with the default pluralSeparator _)

Online version

There's also a web version you can directly use here.

Getting started

Source can be loaded via npm.

# npm package
$ npm install i18next-v4-format-converter

Usage via code:

import { transformNamespace } from 'i18next-v4-format-converter'
const transformed = transformNamespace('en', {
  someKey: 'normal',
  different: 'normal two',
  myKey: 'singular key',
  myKey_plural: 'plural key'
})
// {
//   someKey: 'normal',
//   different: 'normal two',
//   myKey_one: 'singular key',
//   myKey_other: 'plural key'
// }

for Deno:

import { transformNamespace } from 'https://deno.land/x/i18next_v4_format_converter/index.js'
const transformed = transformNamespace('ar', {
  someKey: 'normal',
  different: 'normal two',
  myKey_0: 'no keys',
  myKey_1: 'one key',
  myKey_2: 'two keys',
  myKey_3: 'few {{count}} keys',
  myKey_4: 'many {{count}} keys',
  myKey_5: 'other {{count}} keys'
})
// {
//   someKey: 'normal',
//   different: 'normal two',
//   myKey_zero: 'no keys',
//   myKey_one: 'one key',
//   myKey_two: 'two keys',
//   myKey_few: 'few {{count}} keys',
//   myKey_many: 'many {{count}} keys',
//   myKey_other: 'other {{count}} keys'
// }

Usage via CLI:

# use it with npx
npx i18next-v4-format-converter -i /Users/user/my/input -o /Users/user/my/output

# or install it globally
npm install i18next-v4-format-converter -g

# -i is the input path
# -o is the output path
# if the output path is not provided the, it will save the result in the input path (replaces existing files)

i18next-v4-format-converter -i /Users/user/my/input -o /Users/user/my/output
# i18next-v4-format-converter /Users/user/my/input -o /Users/user/my/output
# i18next-v4-format-converter -o /Users/user/my/output
# i18next-v4-format-converter -i /Users/user/my/input
# i18next-v4-format-converter

Make sure your folder structure looks like this:

└── language
   └── namespace.json

i.e.

├── en
│  ├── translation.json
│  └── common.json
└── de
   ├── translation.json
   └── common.json

Gold Sponsors


From the creators of i18next: localization as a service - locize.com

A translation management system built around the i18next ecosystem - locize.com.

locize

With using locize you directly support the future of i18next.


Keywords

FAQs

Package last updated on 25 May 2024

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