Skip to content

simple language loader - A high-performance language loader for internationalization (i18n) using Rust and N-API, supporting multiline strings, arrays, comments, and caching.

License

Notifications You must be signed in to change notification settings

Skidy89/simple-language-loader

Repository files navigation

Simple Language Loader

simple-language-loader

Simple Language Loader is a fast and lightweight Rust + N-API addon for Node.js that provides a simple yet powerful way to load .lang files with support for arrays, multiline strings, and comments. It’s designed for multilingual projects that need high performance and easy js/ts integration

features

  • Full TypeScript support
  • Automatic caching for repeated loads
  • Simple and readable api
  • Cross-platform Napi bindings
  • Comment support (#)

Installation

npm i @skidy89/ssl.js

Example

import { loadChdlang, generateTypescriptDefs, clearLangCache, load_lang_dsk } from "@skidy89/ssl.js"

// create map cached langs
const langs = loadChdlang("./languages")
// or if you prefer, without any cached langs
const uncachlangs = load_lang_dsk("./languages")

console.log(langs.en.HELLO)
console.log(langs.es.GOODBYE)

// generate typescript files, will throw an error if the path doesnt exist
generateTypescriptDefs("./languages", "./types/langs.d.ts")

// clean the cached languages
clearLangCache()

Warning

this project is still on development, if you encounter an error, let me know or make a pull request

About

simple language loader - A high-performance language loader for internationalization (i18n) using Rust and N-API, supporting multiline strings, arrays, comments, and caching.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published