github.com/elopio/cli@v6.21.2-0.20160902224010-ea909d1fdb2f+incompatible/commands/ui/i18n_test.go (about) 1 package ui_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/commands/ui" 5 "code.cloudfoundry.org/cli/commands/ui/uifakes" 6 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("i18n", func() { 12 var fakeConfig *uifakes.FakeConfig 13 14 BeforeEach(func() { 15 fakeConfig = new(uifakes.FakeConfig) 16 }) 17 18 Context("when the config file is empty", func() { 19 It("returns back default translation", func() { 20 translationFunc, err := GetTranslationFunc(fakeConfig) 21 Expect(err).ToNot(HaveOccurred()) 22 Expect(translationFunc("\nApp started\n")).To(Equal("\nApp started\n")) 23 }) 24 }) 25 26 Context("when the config file is set", func() { 27 Context("when we support the language", func() { 28 BeforeEach(func() { 29 fakeConfig.LocaleReturns("fr-FR") 30 }) 31 32 It("returns back default translation", func() { 33 translationFunc, err := GetTranslationFunc(fakeConfig) 34 Expect(err).ToNot(HaveOccurred()) 35 Expect(translationFunc("\nApp started\n")).To(Equal("\nApplication démarrée\n")) 36 }) 37 }) 38 }) 39 })