Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

indian-translater

arfat-sayyed12MIT1.0.0TypeScript support: included

A powerful translation library for Indian languages with support for date, currency, and number formatting

indian, translation, hindi, marathi, i18n, currency, date-format, number-format

readme

indian-translater

A powerful translation library for Indian languages with built-in support for Hindi and Marathi translations, along with Indian number system, currency, and date formatting.

Features

  • Translation support for Hindi and Marathi
  • Indian number system formatting (lakhs and crores)
  • Indian currency (INR) formatting
  • Indian date formatting
  • Built-in translations (works offline)
  • TypeScript support

Installation

npm install indian-translater

Usage

Basic Translation

import { IndianTranslator } from 'indian-translater';

const translator = new IndianTranslator();

// Translate to Hindi
console.log(translator.translate('hello', 'hi')); // नमस्ते

// Translate to Marathi
console.log(translator.translate('hello', 'mr')); // नमस्कार

Number Formatting

import { IndianFormatters } from 'indian-translater';

// Format number in Indian system
console.log(IndianFormatters.formatNumber(1234567)); // 12,34,567

Currency Formatting

import { IndianFormatters } from 'indian-translater';

// Format currency with symbol
console.log(IndianFormatters.formatCurrency(1234567)); // ₹12,34,567.00

// Format currency without symbol
console.log(IndianFormatters.formatCurrency(1234567, { symbol: false })); // 12,34,567.00

Date Formatting

import { IndianFormatters } from 'indian-translater';

const date = new Date();
console.log(IndianFormatters.formatDate(date)); // DD/MM/YYYY format

Adding Custom Translations

const customTranslations = {
  'good morning': {
    hi: 'शुभ प्रभात',
    mr: 'शुभ सकाळ'
  }
};

translator.addTranslations(customTranslations);

License

MIT