🌍 Ethio-Intl

Modern Ethiopian internationalization library with Amharic transliteration, Ethiopian calendar, Geez numerals, and multi-language support

🔤 Amharic Transliteration

እንኳን ደህና መጡ!
Tip: Use 'e' for ä forms (ሀ), 'ee' for regular e forms (ሄ). Example: "he" → ሀ, "hee" → ሄ

Real-time Transliteration

import { useTransliterate } from 'ethio-intl';

// In your React component
function MyComponent() {
  const [text, setText] = useState('');
  const translated = useTransliterate(text);

  return (
    <input
      value={text}
      onChange={(e) => setText(e.target.value)}
      placeholder="Type in English..."
    />
    <p>{translated}</p>
  );
}

📅 Ethiopian Calendar

Technical: Uses precise astronomical calculations with Julian Day Number algorithm for accurate Gregorian ↔ Ethiopian conversion.

Calendar Conversion

import { toEthDate } from 'ethio-intl';

// Convert Gregorian to Ethiopian
const today = new Date();
const ethDate = toEthDate(today, 'en');
// Result: "Tahsas 13, 2018"

const ethDateAmharic = toEthDate(today, 'am');
// Result: "ታህሳስ 13, 2018"

// Handle leap years automatically
const leapYear = new Date(2024, 8, 11);
const ethLeap = toEthDate(leapYear);
// Result: "Meskerem 1, 2017" (note: 7-8 year offset)

🔢 Geez Numerals

Traditional System: Geez numerals use ፩(1), ፲(10), ፻(100), ፼(10,000). Note the special rules for 100 and 10,000 (no '1' multiplier).

Numeral Conversion

import { toEthNumber, fromEthNumber } from 'ethio-intl';

// Arabic to Geez
const geez = toEthNumber(2025);
// Result: "፳፻፳፭"

const geez100 = toEthNumber(100);
// Result: "፻" (note: no '1' multiplier)

const geez10000 = toEthNumber(10000);
// Result: "፼" (note: no '1' multiplier)

// Geez to Arabic
const arabic = fromEthNumber('፳፻፳፭');
// Result: 2025

🌐 Multi-language Support

Variable Interpolation: Notice how {count} gets replaced with "1,234" automatically. Namespaced translations allow organizing translations by feature/page.

React Context API Integration

// 1. Set up translations
const translations = {
  en: {
    translation: {
      welcome: 'Welcome to Ethio-Intl!',
      userCount: 'We have {count} users',
      namespaced: { header: 'Advanced Features' }
    }
  },
  am: {
    translation: {
      welcome: 'እንኳን ደህና መጡ ወደ ኢትዮ-ኢንትል!',
      userCount: '{count} ተጠቃሚዎች አሉን',
      namespaced: { header: 'የላቀ ባህሪያት' }
    }
  }
};

// 2. Wrap your app
function App() {
  return (
    <EthioProvider
      resources={translations}
      defaultLang="am"
      fallbackLang="en"
    >
      <YourComponents />
    </EthioProvider>
  );
}

// 3. Use in components
function MyComponent() {
  const { t, tNamespace, changeLanguage, currentLang } = useEthioIntl();

  return (
    <div>
      <h1>{t('welcome')}</h1>
      <p>{t('userCount', { count: '1,234' })}</p>
      <p>{tNamespace('namespaced', 'header')}</p>

      <button onClick={() => changeLanguage('am')}>
        Switch to Amharic
      </button>
    </div>
  );
}

✨ Key Features

🔄

Real-time Transliteration

As you type English letters, they instantly become Amharic characters with smart combinations and cursor management.

📅

Astronomical Precision

Uses Julian Day Number algorithm for mathematically precise Gregorian ↔ Ethiopian calendar conversion, accounting for leap years and the 7-8 year offset.

🔢

Traditional Geez Numerals

Convert Arabic numbers to authentic Geez script with proper formatting rules, including special handling for hundreds and ten-thousands.

🌐

Multi-language Support

Built-in internationalization with React Context API, supporting Amharic, English, Tigrinya, and Oromo with extensible architecture.

⚡

Zero Dependencies

All calculations use pure TypeScript/Math - no external libraries required. Perfect for traditional Ethiopian web applications.

🛠️

Enterprise Ready

Dynamic loading, namespaced translations, hot reloading, and development tools for large-scale applications.

Installation & Usage

# Install
npm install ethio-intl

# Import what you need
import { toEthDate, toEthNumber, useTransliterate, EthioProvider } from 'ethio-intl';

// Use in your app
function EthiopianApp() {
  return (
    <EthioProvider resources={translations} defaultLang="am">
      <YourComponents />
    </EthioProvider>
  );
}