Skip to content

Commit

Permalink
feat: support Auslan, mapping to en-AU CLDR data
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-1 committed Jan 26, 2024
1 parent 3c317a6 commit 370871e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func getFallbackTag(tag language.Tag) (language.Tag, error) {
case "ase":
// there is no CLDR locale for American Sign Language, so we need to fall back to en-US
return language.AmericanEnglish, nil
case "asf":
// Australian Sign Language (Auslan)
return language.Make("en-AU"), nil
case "ht":
// Haitian Creole is simply not part of CLDR, as of 2023-01-23. This is very surprising.
return language.Make("fr-HT"), nil
Expand Down
14 changes: 14 additions & 0 deletions locale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,27 @@ func TestGetLocaleData(t *testing.T) {
ta.NoError(err)
ta.Equal(language.AmericanEnglish, language.MustParse(l.Locale))

tag, err = language.Parse("asf")
ta.NoError(err)
ta.Equal("asf", tag.String())
l, err = localizer.GetLocaleData(tag)
ta.NoError(err)
ta.Equal("en-AU", language.MustParse(l.Locale).String())

tag, err = language.Parse("jam")
ta.NoError(err)
ta.Equal("jam", tag.String())
l, err = localizer.GetLocaleData(tag)
ta.NoError(err)
ta.Equal(language.English, language.MustParse(l.Locale))

tag, err = language.Parse("ht")
ta.NoError(err)
ta.Equal("ht", tag.String())
l, err = localizer.GetLocaleData(tag)
ta.NoError(err)
ta.Equal("fr-HT", language.MustParse(l.Locale).String())

tag, err = language.Parse("ca-valencia")
ta.NoError(err)
ta.Equal("ca-valencia", tag.String())
Expand Down

0 comments on commit 370871e

Please sign in to comment.