feat(quando-zbr): implement i18n infrastructure for EN/DE languages
Add internationalization support with translation data for English and German languages. This provides the foundation for localized formatting of dates and durations. Changes: - Add i18n.go with translation maps for month names, weekday names, and duration units (both EN and DE) - Implement helper methods on Lang type: MonthName, MonthNameShort, WeekdayName, WeekdayNameShort, DurationUnit - Add automatic fallback to English for unknown languages - Create comprehensive test suite in i18n_test.go (97.8% coverage) - Update Lang type documentation with future expansion notes - Add example tests demonstrating i18n usage Blocks: quando-10t, quando-5ol, quando-95w
This commit is contained in:
parent
57f9f689d9
commit
436d8dd411
5 changed files with 568 additions and 4 deletions
|
|
@ -458,3 +458,37 @@ func ExampleDate_In_error() {
|
|||
|
||||
// Output: Invalid timezone name
|
||||
}
|
||||
|
||||
// ExampleLang_MonthName demonstrates localized month names
|
||||
func ExampleLang_MonthName() {
|
||||
fmt.Println(quando.EN.MonthName(time.February))
|
||||
fmt.Println(quando.DE.MonthName(time.February))
|
||||
// Output:
|
||||
// February
|
||||
// Februar
|
||||
}
|
||||
|
||||
// ExampleLang_WeekdayName demonstrates localized weekday names
|
||||
func ExampleLang_WeekdayName() {
|
||||
fmt.Println(quando.EN.WeekdayName(time.Monday))
|
||||
fmt.Println(quando.DE.WeekdayName(time.Monday))
|
||||
// Output:
|
||||
// Monday
|
||||
// Montag
|
||||
}
|
||||
|
||||
// ExampleLang_DurationUnit demonstrates localized duration units
|
||||
func ExampleLang_DurationUnit() {
|
||||
// Singular
|
||||
fmt.Println(quando.EN.DurationUnit("month", false))
|
||||
fmt.Println(quando.DE.DurationUnit("month", false))
|
||||
|
||||
// Plural
|
||||
fmt.Println(quando.EN.DurationUnit("month", true))
|
||||
fmt.Println(quando.DE.DurationUnit("month", true))
|
||||
// Output:
|
||||
// month
|
||||
// Monat
|
||||
// months
|
||||
// Monate
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue