indian-l10n
v1.0.2
Published
Indian language localization package compatible with Scratch-style translation keys. Supports Hindi, Tamil, Telugu, Bengali, and more.
Maintainers
Readme
indian-l10n 🇮🇳
Indian language localization package compatible with Scratch-style translation keys. Provides ready-to-use translations for Hindi, Tamil, Telugu, and Bengali — designed for block-based programming environments.
Installation
npm install indian-l10nQuick Start
const { getLanguage, supportedLocales } = require('indian-l10n');
// Get Hindi translations
const hi = getLanguage('hi');
console.log(hi['gui.menuBar.file']); // "फ़ाइल"
console.log(hi['blocks.category.motion']); // "गति"
// Falls back to English if locale not found
const fallback = getLanguage('fr');
console.log(fallback['gui.menuBar.file']); // "File"API
getLanguage(code)
Returns a flat translation object for the given locale code. Falls back to English (en) if the code is not found.
const ta = getLanguage('ta');
console.log(ta['gui.saveNow']); // "இப்போது சேமி"languages
Direct access to all language objects, keyed by locale code.
const { languages } = require('indian-l10n');
console.log(languages.te['gui.controls.go']); // "మొదలుపెట్టు"supportedLocales
Metadata for each supported locale including code, name, and nativeName.
const { supportedLocales } = require('indian-l10n');
console.log(supportedLocales.bn.nativeName); // "বাংলা"isRtl(code)
Returns true if the locale is right-to-left. (No Indian languages are RTL, but included for Scratch compatibility.)
getLanguageNativeName(code)
Returns the native-script name of a language. Returns null for unsupported codes.
const { getLanguageNativeName } = require('indian-l10n');
console.log(getLanguageNativeName('hi')); // "हिन्दी"getLocaleList()
Returns an array of all supported locale codes.
const { getLocaleList } = require('indian-l10n');
console.log(getLocaleList()); // ['en', 'hi', 'ta', 'te', 'bn']isLocaleSupported(code)
Returns true if the given locale code is supported.
Supported Languages
| Code | Language | Native Name |
|------|----------|-------------|
| en | English | English |
| hi | Hindi | हिन्दी |
| ta | Tamil | தமிழ் |
| te | Telugu | తెలుగు |
| bn | Bengali | বাংলা |
Translation Key Format
Translation keys follow Scratch's dot-separated convention:
| Category | Example Key | Description |
|----------|-------------|-------------|
| GUI Menu | gui.menuBar.file | Menu bar items |
| GUI Actions | gui.saveNow | Action buttons |
| Modals | gui.modal.ok | Dialog buttons |
| Alerts | gui.alert.saving | Status messages |
| Sprite Tabs | gui.spriteTabs.code | Tab labels |
| Stage | gui.stageHeader.fullscreen | Stage controls |
| Blocks | blocks.category.motion | Block categories |
| Paint Editor | paint.paintEditor.undo | Paint tools |
| Color Picker | paint.colorPicker.color | Color controls |
Adding a New Language
- Create a new JSON file in
src/languages/(e.g.,mr.jsonfor Marathi) - Copy the keys from
en.jsonand translate the values - Register the language in
src/index.js:- Import the JSON file
- Add it to the
languagesobject - Add metadata to
supportedLocales
- Update
index.d.tswith the new locale type
Contributing
Contributions are welcome! To add or improve translations:
- Fork this repository
- Create a new branch:
git checkout -b add/language-code - Add or edit the language JSON file in
src/languages/ - Ensure all keys from
en.jsonare present and translated - Run tests:
npm test - Submit a pull request
Translation Guidelines
- Keep translations natural and culturally appropriate
- Maintain the same key structure as
en.json - Use Unicode characters — no transliteration
- Technical terms (e.g., "sprite") may be transliterated when no standard term exists
