npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iroco/eslint-svelte-i18n

v0.1.4

Published

ESLint plugin to extract Svelte text into i18n files

Readme

@iroco/eslint-svelte-i18n status-badge

svelte-i18n extractor for ESLint

An ESLint plugin that automatically extracts hardcoded text from .svelte files and moves it into your default svelte-i18n translation file.


Motivation

Internationalizing an existing Svelte project can be tedious when text is already hardcoded in components.

You typically need to:

  • Create new translation keys
  • Replace hardcoded text with $_('key')
  • Manually copy the original text into your translation files

This plugin automates that process.

It scans your .svelte files, generates translation keys, replaces the text in your components, and updates your translation file automatically.

The goal is simple: save time and make internationalization painless.

It can also change your workflow by allowing you to work on your Svelte files without thinking about keys and internationalization and focus on semantics and readability. Then, when your changes are finished, you only have to execute the command line and your changes are ready to be translated.


Installation

npm install -D eslint @iroco/eslint-svelte-i18n

Usage

ESLint Flat Config (eslint.config.js)

This plugin currently provides one rule:

extract-i18n

Example configuration:

import svelteI18nPlugin from '@iroco/eslint-svelte-i18n';

export default [
	{
		plugins: {
			'svelte-i18n': svelteI18nPlugin
		}
	},
	{
		files: ['**/*.svelte'],
		rules: {
			'svelte-i18n/extract-i18n': 'warn'
		}
	},
	{
		ignores: ['build/', '.svelte-kit/', 'dist/']
	}
];

💡 It is recommended to use "warn" instead of "error" so your CI/CD pipelines do not fail unexpectedly.


Rule Options

The rule accepts a single options object with the following properties:

| Option | Type | Default | Description | | --------------------------- | ---------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------- | | translationsFile | string | 'src/lib/i18n/locales/en.json' | Path to your default translation file | | maxWordsInIntermediaryKey | number | 5 | Maximum number of words used when generating translation keys | | maxCharsInDirectKey | number | 50 | Maximum number of characters allowed before generating an intermediary key | | escapedTexts | string[] | [''] | Strings that will not be processed if alone | | excludedWordsInKey | string[] | ['and','or','the','a','an','of','in','on','with','to','for','by'] | Words that will not be in generated keys |

Example with Options

import svelteI18nPlugin from '@iroco/eslint-svelte-i18n';

export default [
	{
		plugins: {
			'svelte-i18n': svelteI18nPlugin
		}
	},
	{
		files: ['**/*.svelte'],
		rules: {
			'svelte-i18n/extract-i18n': [
				'warn',
				{
					translationsFile: './src/lib/i18n/locales/fr.json',
					maxWordsInIntermediaryKey: 6,
					maxCharsInDirectKey: 20,
					escapedTexts: ['Google']
				}
			]
		}
	}
];

License

MIT — see the LICENSE file for details.