Skip to content

Removed unnecessary fmt.*printf before tr(...) #1425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 7, 2021

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 1, 2021

arduino#1425 (comment)

these particular strings are not correctly handled by the i18n package because
they are declared at package level before the call to i18n.Init(), and so are
just returned as-is.
otherwise the unit-tests will fail:

=== RUN   TestBoardOptions
--- FAIL: TestBoardOptions (0.00s)
panic: i18n.Tr called before i18n.Init() [recovered]
	panic: i18n.Tr called before i18n.Init()

goroutine 9 [running]:
testing.tRunner.func1.2(0xc56e00, 0xeaee20)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1143 +0x332
testing.tRunner.func1(0xc0002a2f00)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1146 +0x4b6
panic(0xc56e00, 0xeaee20)
	/opt/hostedtoolcache/go/1.16.7/x64/src/runtime/panic.go:965 +0x1b9
github.com/arduino/arduino-cli/i18n.Tr(0xdceacd, 0x28, 0x0, 0x0, 0x0, 0x0, 0x1)
	/home/runner/work/arduino-cli/arduino-cli/i18n/i18n.go:54 +0xd9
github.com/arduino/arduino-cli/arduino/cores.(*Board).GetBuildProperties(0x13bf060, 0xc0003b6150, 0xc000339400, 0x0, 0x0)
	/home/runner/work/arduino-cli/arduino-cli/arduino/cores/board.go:109 +0x69d
github.com/arduino/arduino-cli/arduino/cores.(*Board).GeneratePropertiesForConfiguration(0x13bf060, 0xdb5f54, 0xe, 0xc000309ef0, 0xc911e0, 0xc0003b6000)
	/home/runner/work/arduino-cli/arduino-cli/arduino/cores/board.go:141 +0x28f
github.com/arduino/arduino-cli/arduino/cores.TestBoardOptions(0xc0002a2f00)
	/home/runner/work/arduino-cli/arduino-cli/arduino/cores/board_test.go:298 +0x4bd
testing.tRunner(0xc0002a2f00, 0xe052a8)
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1193 +0xef
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.16.7/x64/src/testing/testing.go:1238 +0x2b3
FAIL	github.com/arduino/arduino-cli/arduino/cores	0.021s
=== RUN   TestIndexParsing
--- FAIL: TestIndexParsing (0.00s)
panic: i18n.Tr called before i18n.Init() [recovered]
	panic: i18n.Tr called before i18n.Init()
Copy link
Contributor

@silvanocerza silvanocerza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns about certain strings when they'll be translated for right to left languages.

@cmaglie cmaglie merged commit 7415e26 into arduino:master Sep 7, 2021
@cmaglie cmaglie deleted the simplify-fmt-tr branch September 7, 2021 17:21
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants