Skip to content
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

UDENG-133 Fixing some i18n problems #658

Closed
wants to merge 5 commits into from

Conversation

denisonbarbosa
Copy link
Member

We had some issues related to the i18n package. This PR aims to solve them.

denisonbarbosa and others added 2 commits March 29, 2023 10:10
We use the i18n package both in client.New and in daemon.New. This
happens before we initialize the domain with the right locale, so it
results in improper translations.

Co-authored-by: Edu Gómez Escandell <[email protected]>
Using `` is not recognized by the i18n package, so we were printing
nothing in the message.

Co-authored-by: Edu Gómez Escandell <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2023

Codecov Report

Merging #658 (48d45cc) into main (5c978a9) will decrease coverage by 0.03%.
The diff coverage is 89.34%.

@@            Coverage Diff             @@
##             main     #658      +/-   ##
==========================================
- Coverage   84.96%   84.94%   -0.03%     
==========================================
  Files          74       75       +1     
  Lines        8043     8056      +13     
==========================================
+ Hits         6834     6843       +9     
- Misses        910      912       +2     
- Partials      299      301       +2     
Impacted Files Coverage Δ
cmd/admxgen/main.go 0.00% <0.00%> (ø)
cmd/adsysd/daemon/scripts.go 75.00% <ø> (ø)
cmd/adsysd/main.go 83.63% <0.00%> (-1.82%) ⬇️
internal/daemon/daemon.go 94.48% <ø> (ø)
internal/policies/apparmor/apparmor.go 88.46% <0.00%> (+0.19%) ⬆️
internal/policies/manager.go 87.65% <75.00%> (-0.84%) ⬇️
internal/systemd/systemd.go 93.47% <93.47%> (ø)
cmd/adsysd/client/client.go 80.64% <100.00%> (ø)
cmd/adsysd/daemon/daemon.go 85.48% <100.00%> (ø)
cmd/adwatchd/commands/main.go 75.73% <100.00%> (ø)
... and 12 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

The message is already translated a few lines earlier.
@denisonbarbosa denisonbarbosa marked this pull request as ready for review March 30, 2023 10:54
@denisonbarbosa denisonbarbosa requested a review from a team as a code owner March 30, 2023 10:54
Sudoers path: %s
PolicyKit path: %s
Apparmor path: %s`), updateMachine, updateUsers, nextRefresh,
status := fmt.Sprintf(i18n.G("%s\n%s\nNext Refresh: %s\n\n%s\n\nActive Directory:\n %s\n\nDaemon:\n Timeout after %s\n Listening on: %s\n Cache path: %s\n Run path: %s\n Dconf path: %s\n Sudoers path: %s\n PolicyKit path: %s\n Apparmor path: %s"), updateMachine, updateUsers, nextRefresh,

Choose a reason for hiding this comment

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

It's sad that we have to lose in readability.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, can we consider/research any other approach to extract the sentences in po files and to be compatible with bacquote?

(I already personnally dislike the too many unamed "%s" in the middle of sentences, this makes it even harder to maintain in the long term)

Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

One requested change, and I think we should, before merging this, consider if we can’t search for an alternative on string extractions.

@@ -22,6 +22,7 @@ import (

func main() {
var a app
i18n.InitI18nDomain(consts.TEXTDOMAIN)
Copy link
Member

Choose a reason for hiding this comment

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

I think the a declaration is for the daemon below. So I would just move that one up. It’s not C89 :)

Sudoers path: %s
PolicyKit path: %s
Apparmor path: %s`), updateMachine, updateUsers, nextRefresh,
status := fmt.Sprintf(i18n.G("%s\n%s\nNext Refresh: %s\n\n%s\n\nActive Directory:\n %s\n\nDaemon:\n Timeout after %s\n Listening on: %s\n Cache path: %s\n Run path: %s\n Dconf path: %s\n Sudoers path: %s\n PolicyKit path: %s\n Apparmor path: %s"), updateMachine, updateUsers, nextRefresh,
Copy link
Member

Choose a reason for hiding this comment

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

I agree, can we consider/research any other approach to extract the sentences in po files and to be compatible with bacquote?

(I already personnally dislike the too many unamed "%s" in the middle of sentences, this makes it even harder to maintain in the long term)

@didrocks didrocks changed the title Fixing some i18n problems UDENG-133 Fixing some i18n problems Apr 18, 2023
@didrocks
Copy link
Member

And with the new i18n, I think we can drop this one!

@didrocks didrocks closed this Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants