Add i18n support for 15 additional languages

Extends internationalization support from 2 languages (EN, DE) to 17 total
languages, meeting the DatesAPI website's advertised language count.

Added languages (15):
- Latin script: ES, FR, IT, PT, NL, PL, RU, TR, VI
- Non-Latin script: JA, KO, ZhCN, ZhTW, HI, TH

Changes:
- Added 15 new Lang constants to date.go (using ZhCN/ZhTW naming convention)
- Extended all 5 i18n maps in i18n.go with CLDR-accurate translations:
  * monthNames: 12 months × 15 languages (180 entries)
  * monthNamesShort: 12 abbreviated months × 15 languages
  * weekdayNames: 7 weekdays × 15 languages (105 entries)
  * weekdayNamesShort: 7 abbreviated weekdays × 15 languages
  * durationUnits: 7 units × 2 forms × 15 languages (210 entries)
- Documented plural form limitation for PL/RU (complex plural rules)
- Added comprehensive test coverage (135 new test cases)
- Verified UTF-8 encoding for non-Latin scripts

Test results:
- All 955 tests passing
- Coverage: 99.5% (exceeds 95% target)
- No performance regression (static data only)

Closes: quando-cvw
This commit is contained in:
Oliver Jakoubek 2026-02-12 14:59:37 +01:00
commit f8c486132d
4 changed files with 596 additions and 15 deletions

35
date.go
View file

@ -7,9 +7,8 @@ import (
// Lang represents a language for internationalization (i18n) in formatting.
//
// Phase 1 supports English (EN) and German (DE). Future phases will expand to
// include 21 additional languages: FR, ES, IT, PT, NL, PL, RU, JA, ZH, KO, AR,
// HI, TR, SV, NO, DA, FI, CS, HU, RO, UK, EL.
// Currently supports 17 languages: EN, DE, ES, FR, IT, PT, NL, PL, RU, TR, VI,
// JA, KO, ZhCN, ZhTW, HI, TH.
//
// Language affects:
// - Format(Long): month and weekday names
@ -28,6 +27,36 @@ const (
EN Lang = "en"
// DE represents German (Deutsch) language.
DE Lang = "de"
// ES represents Spanish (Español) language.
ES Lang = "es"
// FR represents French (Français) language.
FR Lang = "fr"
// IT represents Italian (Italiano) language.
IT Lang = "it"
// PT represents Portuguese (Português) language.
PT Lang = "pt"
// NL represents Dutch (Nederlands) language.
NL Lang = "nl"
// PL represents Polish (Polski) language.
PL Lang = "pl"
// RU represents Russian (Русский) language.
RU Lang = "ru"
// TR represents Turkish (Türkçe) language.
TR Lang = "tr"
// VI represents Vietnamese (Tiếng Việt) language.
VI Lang = "vi"
// JA represents Japanese (日本語) language.
JA Lang = "ja"
// KO represents Korean (한국어) language.
KO Lang = "ko"
// ZhCN represents Chinese Simplified (简体中文) language.
ZhCN Lang = "zh-cn"
// ZhTW represents Chinese Traditional (繁體中文) language.
ZhTW Lang = "zh-tw"
// HI represents Hindi (हिन्दी) language.
HI Lang = "hi"
// TH represents Thai (ไทย) language.
TH Lang = "th"
)
// Date wraps time.Time and provides a fluent API for date operations.