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

weather-i18n

v1.2.0

Published

I18n utilities and icon mappings for WMO weather codes

Readme

weather-i18n

A lightweight, fully typed TypeScript library for internationalizing, validating, and mapping weather condition codes (WMO 4677) with multilingual descriptions and popular icon sets.

Features

  • 🌐 Internationalization (i18n): Translate WMO 4677 weather codes into multiple languages (en, es) with day/night phase support (day / night) and fallback language support.
  • 📐 Complete Specification: Comprehensive definitions, human-readable keys (key), and reverse mappings for WMO 4677 weather codes.
  • 🛡️ Zod Validation: Flexible schema to validate and transform numeric inputs (95), string values ("95"), or human-readable keys ("thunderstorm_slight_moderate_no_hail").
  • 🎨 Icon Mapping: Automatically map weather codes to popular icon packs such as Meteocons, Material Weather Icons and Pixelarticons, with both day and night variants.
  • 📦 Tree-Shaking & Subpath Imports: Import only what you need or access the raw JSON data directly.

Installation

# Using pnpm
pnpm add weather-i18n

# Using npm
npm install weather-i18n

# Using yarn
yarn add weather-i18n

Import Options

Once the package is installed, you can import it in different ways depending on your bundling strategy and project architecture.

1. Main Import (Full Bundle)

import { WMO4677 } from "weather-i18n";

// Unified access to spec, i18n, validator, and icons
const desc = WMO4677.i18n("es")(95, "day");
const parsed = WMO4677.validator.parse("95");

2. WMO 4677 Module

import WMO4677 from "weather-i18n/wmo_4677";

const desc = WMO4677.i18n("en")(3, "night");

3. Subpath Imports

To optimize your bundle size or use specific features independently:

// Internationalization
import WMO4677I18n from "weather-i18n/wmo_4677/i18n";
const getDesc = WMO4677I18n("es", "en");
console.log(getDesc(95, "day")); // "Thunderstorm"

// Complete specification
import WMO4677Spec from "weather-i18n/wmo_4677/spec";
console.log(WMO4677Spec[95].key); // "thunderstorm_slight_moderate_no_hail"

// Zod validator
import WMO4677Validator from "weather-i18n/wmo_4677/validator";
const result = WMO4677Validator.parse("05");

// Icons (All)
import WMO4677Icons from "weather-i18n/wmo_4677/icons";
console.log(WMO4677Icons.meteocons(95, "day"));

// Individual icon helpers
import WMO4677Meteocons from "weather-i18n/wmo_4677/icons/meteocons";
import WMO4677MaterialWeatherIcons from "weather-i18n/wmo_4677/icons/material-weather-icons";

console.log(WMO4677Meteocons(95, "night", {
  withUrlTemplate: true,
  variant: "flat",
  format: "svg-static"
}));
console.log(WMO4677MaterialWeatherIcons(95, "day"));

4. Direct JSON Imports

You can import the original JSON data files using Import Attributes (or assertions, depending on your environment):

import WMO4677I18nEN from "weather-i18n/wmo_4677/data/i18n/en.json" with { format: "json" };
import WMO4677I18nES from "weather-i18n/wmo_4677/data/i18n/es.json" with { format: "json" };
import WMO4677Meteocons from "weather-i18n/wmo_4677/data/icons/meteocons.json" with { format: "json" };
import WMO4677MaterialWeatherIcons from "weather-i18n/wmo_4677/data/icons/material-weather-icons.json" with { format: "json" };

(Note: In Node.js v20+/v22+ and modern bundlers, with { type: "json" } is also supported.)


API Overview

Internationalization (i18n)

Create a formatter by specifying the desired language and, optionally, a fallback language:

import WMO4677I18n from "weather-i18n/wmo_4677/i18n";

const getDesc = WMO4677I18n("es", "en");

// Get the daytime description for code 95
const daytimeText = getDesc(95, "day"); // "Tormenta"

// Get the nighttime description
const nighttimeText = getDesc(95, "night");

Zod Validator (validator)

Parses input values as integers (0-99), strings ("05"), or human-readable keys ("haze"), returning a structured object:

import WMO4677Validator from "weather-i18n/wmo_4677/validator";

const data = WMO4677Validator.parse("5");
// Result:
// {
//   code: 5,
//   key: "haze",
//   description: "Haze"
// }

Development & Scripts

If you'd like to contribute or run the local build and validation scripts:

# Install dependencies
pnpm install

# Compile TypeScript into /dist
pnpm build

# Run tests and validation
pnpm test

License

ISC