Skip to content

Commit

Permalink
Merge pull request #71 from razor-1/more-unknown-locales
Browse files Browse the repository at this point in the history
Handle Fon and Twi
  • Loading branch information
razor-1 authored Oct 8, 2024
2 parents c17b336 + 9637caa commit 4353759
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.23'
check-latest: true
- name: checkout
uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.55
version: v1.61
6 changes: 0 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
linters:
enable:
- golint
issues:
include:
- EXC0002 # disable excluding of issues about comments from golint
4 changes: 4 additions & 0 deletions locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ func getFallbackTag(tag language.Tag) (language.Tag, error) {
return language.English, nil
case "bzj":
return language.English, nil
case "fon":
return language.Make("ee"), nil
case "tw":
return language.Make("ak"), nil
}

return language.Tag{}, fmt.Errorf("no fallback for tag %s", tag.String())
Expand Down
14 changes: 14 additions & 0 deletions locale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,18 @@ func TestGetLocaleData(t *testing.T) {
l, err = localizer.GetLocaleData(tag)
ta.NoError(err)
ta.Equal("en", language.MustParse(l.Locale).String())

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

tag, err = language.Parse("tw")
ta.NoError(err)
ta.Equal("tw", tag.String())
l, err = localizer.GetLocaleData(tag)
ta.NoError(err)
ta.Equal("ak", language.MustParse(l.Locale).String())
}

0 comments on commit 4353759

Please sign in to comment.