Skip to content

m4cd4r4/irish-dictionary

Repository files navigation

irish-dictionary

2,003 curated Irish-English dictionary entries. Zero dependencies. TypeScript-first.

Built for Irish language apps, learning tools, and Gaeilge-supporting platforms. Extracted from Chlann — an Irish-language family messaging PWA.


Features

  • 2,003 entries across 22 categories — family, greetings, food, nature, health, culture, and more
  • Bidirectional search — English → Irish and Irish → English
  • Fada-insensitive — search mathair or máthair, both work
  • Zero dependencies — pure TypeScript, no external packages
  • Tree-shakeable — import only what you need
  • Dual ESM + CJS — works in React, Vue, Svelte, Next.js, Node.js, Deno
  • Fully typed — rich TypeScript types with JSDoc

Installation

npm install irish-dictionary
# or
pnpm add irish-dictionary
# or
yarn add irish-dictionary

Quick Start

import { DICTIONARY_ENTRIES, search, wordOfTheDay } from 'irish-dictionary';

// Search English → Irish
const results = search(DICTIONARY_ENTRIES, 'mother');
// → [{ irish: 'máthair', english: 'mother', category: 'family', ... }]

// Search Irish → English (fada-insensitive)
const results2 = search(DICTIONARY_ENTRIES, 'mathair');
// → same result

// Filter by category
const familyWords = search(DICTIONARY_ENTRIES, '', { category: 'family', limit: 100 });

// Word of the day (deterministic per calendar day)
const wotd = wordOfTheDay(DICTIONARY_ENTRIES);
console.log(`${wotd.irish}${wotd.english}`);

API

search(entries, query, options?)

Searches entries by Irish or English, fada-insensitive.

import { DICTIONARY_ENTRIES, search } from 'irish-dictionary';

const result = search(DICTIONARY_ENTRIES, 'family', {
  category: 'family',  // optional: filter by category
  limit: 20,           // optional: max results (default: 50)
});

console.log(result.entries);  // DictionaryEntry[]
console.log(result.total);    // total matches (before limit)
console.log(result.query);    // original query

wordOfTheDay(entries)

Returns a deterministic entry based on today's date. Same result for the whole calendar day.

import { DICTIONARY_ENTRIES, wordOfTheDay } from 'irish-dictionary';

const wotd = wordOfTheDay(DICTIONARY_ENTRIES);
// { id: 'slan', irish: 'slán', english: 'goodbye', category: 'greetings', ... }

findById(entries, id)

Look up a single entry by its slug ID.

import { DICTIONARY_ENTRIES, findById } from 'irish-dictionary';

const entry = findById(DICTIONARY_ENTRIES, 'mathair');
// { id: 'mathair', irish: 'máthair', english: 'mother', ... }

findByEnglish(entries, english)

Find entries matching an exact English word (case-insensitive, checks english and englishAlt).

const entries = findByEnglish(DICTIONARY_ENTRIES, 'hello');

findByIrish(entries, irish)

Find entries matching an exact Irish word (fada-insensitive).

const entries = findByIrish(DICTIONARY_ENTRIES, 'dia duit');

categoryCounts(entries)

Count entries per category — useful for building category filter UIs.

import { DICTIONARY_ENTRIES, categoryCounts } from 'irish-dictionary';

const counts = categoryCounts(DICTIONARY_ENTRIES);
// { family: 120, greetings: 100, food: 140, ... }

normalizeIrish(text)

Strips fadas and lowercases text for comparison.

import { normalizeIrish } from 'irish-dictionary';

normalizeIrish('Máthair');  // → 'mathair'
normalizeIrish('Tá sé go maith');  // → 'ta se go maith'

Data Model

interface DictionaryEntry {
  id: string;               // ASCII slug: "mathair"
  irish: string;            // with fadas: "máthair"
  english: string;          // primary: "mother"
  englishAlt?: string[];    // alternatives: ["mom", "mam"]
  partOfSpeech: PartOfSpeech;
  category: DictionaryCategory;
  gender?: 'masculine' | 'feminine';
  searchTerms: string[];    // pre-computed, fada-stripped, lowercase
}

type PartOfSpeech =
  | 'noun' | 'verb' | 'adjective' | 'adverb'
  | 'pronoun' | 'preposition' | 'conjunction'
  | 'interjection' | 'phrase' | 'number';

type DictionaryCategory =
  | 'family'   | 'greetings'    | 'emotions'  | 'conversation'
  | 'food'     | 'home'         | 'time'      | 'nature'
  | 'body'     | 'school'       | 'travel'    | 'numbers'
  | 'colors'   | 'common'       | 'health'    | 'weather'
  | 'sports'   | 'work'         | 'places'    | 'clothing'
  | 'music'    | 'culture';

Categories

Category Irish Entries
family teaghlach ~120
greetings beannachtaí ~100
emotions mothúcháin ~120
conversation comhrá ~130
food bia ~140
home baile ~100
time am ~100
nature nádúr ~100
body corp ~90
school scoil ~90
travel taisteal ~85
numbers uimhreacha ~50
colors dathanna ~35
common coitianta ~170
health sláinte ~110
weather aimsir ~75
sports spórt ~105
work obair ~120
places áiteanna ~100
clothing éadaí ~70
music ceol ~75
culture cultúr ~90

Usage Examples

React hook

import { useState, useMemo } from 'react';
import { DICTIONARY_ENTRIES, search, type DictionaryCategory } from 'irish-dictionary';

function useDictionary(initialCategory?: DictionaryCategory) {
  const [query, setQuery] = useState('');
  const [category, setCategory] = useState<DictionaryCategory | null>(
    initialCategory ?? null
  );

  const results = useMemo(
    () => search(DICTIONARY_ENTRIES, query, { category, limit: 50 }),
    [query, category]
  );

  return { query, setQuery, category, setCategory, results };
}

Next.js / dynamic import (code splitting)

// Load the dictionary only when needed
const { DICTIONARY_ENTRIES, search } = await import('irish-dictionary');
const results = search(DICTIONARY_ENTRIES, 'hello');

Node.js

const { DICTIONARY_ENTRIES, search } = require('irish-dictionary');
const results = search(DICTIONARY_ENTRIES, 'family');
console.log(results.entries[0]);

Adding your own entries

import { DICTIONARY_ENTRIES, search, type DictionaryEntry } from 'irish-dictionary';

const myEntries: DictionaryEntry[] = [
  {
    id: 'my-custom-word',
    irish: 'm\'fhocal',
    english: 'my word',
    partOfSpeech: 'noun',
    category: 'common',
    searchTerms: ['mfhocal', 'my word'],
  },
];

const combined = [...DICTIONARY_ENTRIES, ...myEntries];
const results = search(combined, 'my word');

Bundle Size

Format Raw Gzipped
ESM ~160 kB ~39 kB
CJS ~160 kB ~39 kB

The entire dataset is ~160 kB raw. In a browser app, use dynamic import() to code-split so it only loads when your dictionary UI opens.

Contributing

Contributions welcome — especially:

  • Additional entries (aim for accuracy over quantity)
  • Grammar notes and example sentences
  • Verb conjugation tables
  • Corrections to existing entries

Please open an issue before submitting large PRs.

Roadmap

  • Example sentences for each entry
  • Grammar notes (declensions, mutations)
  • Verb conjugation tables (50 common verbs)
  • Pronunciation guide (IPA)
  • Audio pronunciation files
  • React component package (@irish-dictionary/react)
  • Scraped & curated entries from Téarma.ie

License

MIT © Macdara Mac Domhnaill


Go n-éirí leat le do chuid Gaeilge! — Good luck with your Irish!

About

2003 curated Irish-English dictionary entries. Zero dependencies. TypeScript-first. For Irish language apps and learning tools.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors