From 949042f81b114b391c99866fcb6e5340dabd7247 Mon Sep 17 00:00:00 2001 From: Eugene Date: Sun, 8 Sep 2024 11:14:30 -0300 Subject: [PATCH 1/2] Load yml files too --- mf/bundle.go | 2 +- mf/bundle_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mf/bundle.go b/mf/bundle.go index ef507ba..b7e7a39 100644 --- a/mf/bundle.go +++ b/mf/bundle.go @@ -83,7 +83,7 @@ func (b *bundle) LoadDir(dir fs.FS) error { return nil } - if path.Ext(f.Name()) != ".yaml" { + if path.Ext(f.Name()) != ".yaml" || path.Ext(f.Name()) != ".yml" { return nil } diff --git a/mf/bundle_test.go b/mf/bundle_test.go index 8dc7ffa..7eab3b0 100644 --- a/mf/bundle_test.go +++ b/mf/bundle_test.go @@ -125,9 +125,11 @@ func TestBundle_LoadDir(t *testing.T) { require.NoError(t, b.LoadDir(fstest.MapFS{ "messages.en.yaml": {Data: []byte("foo: bar")}, "messages.es.yaml": {Data: []byte("foo: bar")}, + "messages.ru.yml": {Data: []byte("foo: bar")}, }), "no error on normal yaml files") assert.NotNil(t, b.dictionaries[language.English]) assert.NotNil(t, b.dictionaries[language.Spanish]) + assert.NotNil(t, b.dictionaries[language.Russian]) } func TestBundle_Translator(t *testing.T) { From 6b3087d75072bf7b2f411a72a0e07f268393b71e Mon Sep 17 00:00:00 2001 From: Eugene Date: Sun, 8 Sep 2024 11:15:43 -0300 Subject: [PATCH 2/2] Fix yml handling --- mf/bundle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mf/bundle.go b/mf/bundle.go index b7e7a39..702318b 100644 --- a/mf/bundle.go +++ b/mf/bundle.go @@ -83,7 +83,7 @@ func (b *bundle) LoadDir(dir fs.FS) error { return nil } - if path.Ext(f.Name()) != ".yaml" || path.Ext(f.Name()) != ".yml" { + if path.Ext(f.Name()) != ".yaml" && path.Ext(f.Name()) != ".yml" { return nil }