Skip to content

@breadstone/ziegel-intl ​

MIT LicenseTypeScriptnpm

Comprehensive internationalization (i18n) and globalization support for the ziegel framework. Provides cultures, calendars, regions, time zones, formatting, and localization for global applications.

Internationalization: Complete i18n solution with multi-calendar support, culture information, formatting, and globalization resources.

🚀 Overview ​

@breadstone/ziegel-intl provides:

  • Multi-Calendar Support: Gregorian, Hebrew, Hijri, Japanese, Korean, Persian, Thai Buddhist, Chinese Lunisolar, and more
  • Culture Information: Comprehensive culture and language data with formatting rules
  • Regional Data: Geographic and cultural region information
  • Time Zone Management: Time zone handling, conversion, and calculations
  • Formatting System: Date/time and number formatting with locale support
  • Format Decorators: Easy formatting via TypeScript decorators
  • Globalization Resources: String resources and localization support

📦 Installation ​

bash
npm install @breadstone/ziegel-intl
# or
yarn add @breadstone/ziegel-intl

🧩 Features & Usage Examples ​

Culture Information ​

typescript
import { CultureInfo, DateTimeFormatInfo, NumberFormatInfo } from '@breadstone/ziegel-intl';

const culture = new CultureInfo('en-US');
const dateFormat = culture.dateTimeFormat;
const numberFormat = culture.numberFormat;

Calendar Systems ​

typescript
import {
  GregorianCalendar, HijriCalendar, HebrewCalendar,
  JapaneseCalendar, PersianCalendar, ThaiBuddhistCalendar
} from '@breadstone/ziegel-intl';

const gregorian = new GregorianCalendar();
const hijri = new HijriCalendar();
const japanese = new JapaneseCalendar();
const persian = new PersianCalendar();

Date/Time Formatting ​

typescript
import { DateTimeFormat, Format } from '@breadstone/ziegel-intl';

class EventService {
  @Format('yyyy-MM-dd HH:mm:ss')
  formatEventTime(date: Date): string {
    return DateTimeFormat.format(date, 'yyyy-MM-dd HH:mm:ss');
  }
}

Region and Time Zone ​

typescript
import { RegionInfo, TimeZoneInfo } from '@breadstone/ziegel-intl';

const usRegion = new RegionInfo('US');
const nyTimeZone = TimeZoneInfo.findSystemTimeZoneById('America/New_York');
const utcOffset = nyTimeZone.getUtcOffset(new Date());

Globalization Resources ​

typescript
import { GlobalizationResource, IGlobalizationResource } from '@breadstone/ziegel-intl';

@GlobalizationResource('MyResources')
class MyLocalizedClass {
  // Class with globalization support
}

📅 Supported Calendar Systems ​

Major Calendar Systems ​

  • GregorianCalendar: Standard Western calendar
  • HijriCalendar: Islamic calendar
  • HebrewCalendar: Jewish calendar
  • JapaneseCalendar: Japanese era-based calendar
  • KoreanCalendar: Korean calendar system
  • PersianCalendar: Persian/Iranian calendar
  • ThaiBuddhistCalendar: Thai Buddhist calendar

Lunisolar Calendars ​

  • ChineseLunisolarCalendar: Chinese traditional calendar
  • JapaneseLunisolarCalendar: Japanese lunisolar calendar
  • KoreanLunisolarCalendar: Korean lunisolar calendar
  • TaiwanLunisolarCalendar: Taiwan lunisolar calendar

Historical Calendars ​

  • JulianCalendar: Historical Julian calendar
  • UmAlQuraCalendar: Saudi Arabian calendar
  • TaiwanCalendar: Republic of China calendar

📚 Package import points ​

typescript
import {
    // Formatting
    Formatting, DateTimeFormat, Format, TimeSpanFormat,

    // Globalization Core
    Globalization, Culture, CultureInfo,

    // Calendar Systems
    Calendar, CalendarWeekRule, ICalendarInfo,
    GregorianCalendar, HijriCalendar, HebrewCalendar,
    JapaneseCalendar, JulianCalendar, KoreanCalendar,
    PersianCalendar, ThaiBuddhistCalendar,

    // Lunisolar Calendars
    ChineseLunisolarCalendar, JapaneseLunisolarCalendar,
    KoreanLunisolarCalendar, TaiwanLunisolarCalendar,
    TaiwanCalendar, UmAlQuraCalendar,

    // Format Information
    DateTimeFormatInfo, IDateTimeFormatInfo,
    NumberFormatInfo, INumberFormatInfo,

    // Region Information
    RegionInfo, IRegionInfo,

    // Time Zone Management
    TimeZone, TimeZoneInfo, TimeZoneExtensions, ITimeZone,

    // Globalization Resources
    GlobalizationResource, IGlobalizationResource
} from '@breadstone/ziegel-intl';

📚 API Documentation ​

For detailed API documentation, visit: API Docs

  • @breadstone/ziegel-core: Foundation utilities and type definitions
  • @breadstone/ziegel-intl-commerce: Commerce-specific internationalization
  • @breadstone/ziegel-intl-units: Units of measurement and conversion

License ​

MIT

Issues ​

Please report bugs and feature requests in the Issue Tracker maxSize: 1000, ttl: 300000 // 5 minutes });

const result = cachedFormat('common.greeting', { name: 'John' }, 'en');


## Migration Guide

### From react-i18next

```typescript
// Before (react-i18next)
import { useTranslation } from 'react-i18next';

function Component() {
  const { t, i18n } = useTranslation();
  return <div&gt;{t('welcome', { name: 'John' })}</div&gt;;
}

// After (ziegel-intl)
import { useIntl } from '@ziegel/intl/react';

function Component() {
  const { format } = useIntl();
  return <div&gt;{format('welcome', { name: 'John' })}</div&gt;;
}

From FormatJS ​

typescript
// Before (FormatJS)
import { FormattedMessage } from 'react-intl';

<FormattedMessage
  id="welcome"
  defaultMessage="Welcome {name}"
  values={{ name: 'John' }}
/>

// After (ziegel-intl)
import { useIntl } from '@ziegel/intl/react';

function Component() {
  const { format } = useIntl();
  return <span&gt;{format('welcome', { name: 'John' })}</span&gt;;
}

API Reference ​

For complete API documentation, see the API Reference.