New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@localey/js

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@localey/js

JavaScript and TypeScript Runtime SDK for Localey.

latest
npmnpm
Version
0.1.26
Version published
Maintainers
1
Created
Source

@localey/js

JavaScript and TypeScript Runtime SDK for Localey.

The @localey/js package is an ultra-lightweight, zero-dependency SDK designed to perform string resolution and interpolation at runtime. It is the primary runtime for web applications using React, Svelte, or vanilla JavaScript.

Setup and Initialization

To use the SDK, you must initialize it with your locale-specific translations.

import { init, t } from "@localey/js";
import enTranslations from "./locales/en.json";

init({
  locale: "en",
  translations: enTranslations,
});

Core Functionality

String Translation

The t() function is the primary interface for retrieving localized content. It supports nested key access using dot notation.

// For a translation object: { "auth": { "login": "Sign In" } }
t("auth.login"); // Returns: "Sign In"

Parameter Interpolation

The SDK supports dynamic value insertion through a parameter object.

// For a translation string: "Hello {name}!"
t("greeting", { name: "Alice" }); // Returns: "Hello Alice!"

Type-Safe Integration

When combined with the Localey CLI's types command, you can use generated key maps to ensure that only valid keys are passed to the t() function, providing compile-time verification of your localization logic.

Technical Specifications

  • Performance: Constant-time lookup for flat objects and efficient traversal for nested structures.
  • Size: Minimized bundle footprint suitable for high-performance frontend applications.
  • Compatibility: Compatible with all modern browsers and Node.js environments.

FAQs

Package last updated on 25 Mar 2026

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