Deno
500K+ weekly downloads

Deno i18n & Localization Guide

Secure TypeScript-first i18n with Deno. Modern runtime with built-in tooling. Web standard APIs. Perfect for secure, modern applications.

Prerequisites

  • Deno 1.x runtime installed
  • Basic TypeScript knowledge
  • Understanding of i18n concepts

Common Challenges

Problems developers face when localizing Deno apps—and how IntlPull helps.

npm Compatibility

Not all npm packages work. Some i18n libraries need adaptation or alternatives.

Smaller Ecosystem

Fewer Deno-specific i18n libraries. May need to adapt Node.js patterns.

Learning Curve

Different from Node.js patterns. Permissions and URL imports need adjustment.

Various Features

Why Various is a great choice for Deno localization.

TypeScript Native

No compilation step. TypeScript runs directly. Type-safe translations out of the box.

vs TypeScript compilation

Secure by Default

Explicit permissions model. Control file and network access. Secure translation loading.

vs unrestricted access

Web Standard APIs

Native Intl API support. fetch, URL, and web APIs work natively. Modern JavaScript.

vs Node.js polyfills

URL Imports

Import i18n libraries directly from URLs. No package.json required. esm.sh compatibility.

vs npm install

Fresh Framework

First-class i18n support with Deno Fresh. Island architecture with localized components.

vs heavy frameworks

Built-in Tooling

deno fmt, deno lint, deno test included. No separate toolchain setup.

vs configuring tools

Quick Setup

Get Various running in your Deno project.

1

Create Deno Project

Initialize a Deno project with TypeScript.

deno init my-app
cd my-app
2

Create Translation Files

Set up locale JSON files.

// locales/en.json
{
  "welcome": {
    "title": "Welcome to Deno",
    "description": "A secure JavaScript runtime"
  },
  "nav": {
    "home": "Home",
    "about": "About"
  }
}

// locales/es.json
{
  "welcome": {
    "title": "Bienvenido a Deno",
    "description": "Un runtime JavaScript seguro"
  },
  "nav": {
    "home": "Inicio",
    "about": "Acerca"
  }
}
3

Create i18n Module

Build a simple i18n helper.

// src/i18n.ts
type Translations = Record<string, Record<string, string>>;
type Locale = 'en' | 'es' | 'de';

const translations: Record<Locale, Translations> = {
  en: {},
  es: {},
  de: {},
};

let currentLocale: Locale = 'en';

export async function loadLocale(locale: Locale): Promise<void> {
  if (!translations[locale] || Object.keys(translations[locale]).length === 0) {
    const data = await Deno.readTextFile(`./locales/${locale}.json`);
    translations[locale] = JSON.parse(data);
  }
  currentLocale = locale;
}

export function t(key: string): string {
  const keys = key.split('.');
  let result: any = translations[currentLocale];
  for (const k of keys) {
    result = result?.[k];
  }
  return result ?? key;
}

export { currentLocale };
4

Use Translations

Access translations in your Deno application.

// main.ts
import { loadLocale, t } from './src/i18n.ts';

await loadLocale('en');
console.log(t('welcome.title')); // "Welcome to Deno"

await loadLocale('es');
console.log(t('welcome.title')); // "Bienvenido a Deno"

// With native Intl API
const formatter = new Intl.DateTimeFormat('es-ES', {
  dateStyle: 'full',
});
console.log(formatter.format(new Date()));
5

Run with Permissions

Execute with file read permission.

deno run --allow-read=./locales main.ts

IntlPull Integration

Connect IntlPull to manage translations professionally.

1

Install IntlPull CLI

Add the CLI for translation management.

# Using npm (works with Deno's npm: specifier)
npm install -g @intlpull/cli
2

Configure intlpull.json

Set up the project configuration.

{
  "projectId": "your-project-id",
  "format": "json",
  "sourceLocale": "en",
  "localesDir": "./locales",
  "filePattern": "{locale}.json"
}
3

Pull Translations

Download translations from IntlPull.

npx intlpull pull
4

Add to Deno Task

Integrate with deno.json tasks.

// deno.json
{
  "tasks": {
    "i18n:pull": "npx intlpull pull",
    "dev": "deno task i18n:pull && deno run --allow-read --allow-net main.ts"
  }
}

Frequently Asked Questions

Ready to Localize Your Deno App?

Start with our free tier. No credit card required.

    Deno i18n & Localization Guide | IntlPull | IntlPull