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

@awsless/i18n

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awsless/i18n

The `@awsless/i18n` package is a Vite plugin that automatically translates your text during build time using AI or any other tool you prefer. The plugin will inline the translations so you don't have to worry about loading the translations at the right ti

latest
Source
npmnpm
Version
0.0.15
Version published
Maintainers
2
Created
Source

AI-generated internationalization made easy

The @awsless/i18n package is a Vite plugin that automatically translates your text during build time using AI or any other tool you prefer. The plugin will inline the translations so you don't have to worry about loading the translations at the right time. This means, switching the locale will instantly switch all your translated text on the page.

Features

  • Automatic text translation
  • Inlines translations
  • Extremely lightweight (431 bytes uncompressed 🔥)
  • Instant locale switch
  • Svelte 5 support

Setup

Install with (NPM):

npm i @awsless/i18n

Vite installation

import { i18n, ai } from '@awsless/i18n'
import { openai } from '@ai-sdk/openai'

export defineConfig({
  plugins: [
    i18n({
      default: 'en',
      locales: ['es', 'jp'],
      translate: ai({
		maxTokens: 32_000,
		model: openai('gpt-4.1'),
      })
    })
  ]
})

Svelte example

import { lang } from '@awsless/i18n/svelte'

const count = 1

lang.t`${count} count`

The plugin will find all instances where you want text to be translated. The text is translated automatically during build time to produce a bundled output something like this:

import { lang } from '@awsless/i18n/svelte'

const count = 1

lang.t.get(lang.s`${count} count`, {
	es: lang.s`${count} contar`,
	jp: lang.s`${count} カウント`,
})

To change the locale that is being rendered simply change the lang.locale property.

import { lang } from '@awsless/i18n/svelte'

lang.locale = 'jp'

Changing the AI-generated text

A i18n.generated.json file with the auto-generated translations will be created in the root of your project the first time you run a build. We use this file as a cache to not translate any text that has already been translated before.

If you want to overwrite an AI-generated translation, create or edit i18n.json. Any translation in i18n.json takes precedence over the generated cache during build time.

{
	"${count} count": {
		"es": "${count} contar",
		"jp": "${count} カウント"
	}
}

Keywords

vite

FAQs

Package last updated on 07 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