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

Fix force-locale option for CLI and GUI #4975

Merged
merged 3 commits into from May 13, 2024

Conversation

Jojo-1000
Copy link
Contributor

Changes to make the force-locale option work correctly:

  • Localization culture is set from multiple threads on the server, so use current local context for every new call instead of global context
  • Change locale before executing help commands if flag is present
  • When force-locale is set, also change locale for log messages

There might be some issues with multiple threads which I have not tested (other threads within a backup operation might have the default locale for log messages again). For that we would need to find different translated log messages in the parallel runners (DataBlockProcessor, FileBlockProcessor, ...). It might or might not be that the context is inherited when creating new threads.

Closes #4176

Steps to reproduce (Backup job)

  • Add advanced option --force-locale with a non-default language
  • Remove read permission of a file in the backup set to cause an error
  • Open live log and run backup via GUI

Current behavior:

  • The unauthorized access exception in the live log is translated correctly
  • In the database log all translatable messages are still in default language (see StartingOperation )

New behavior:

  • The unauthorized access exception in the live log is translated correctly
  • In the database log all translatable messages are translated (see StartingOperation )

Steps to reproduce (help)

  • Run help advanced command with --force-locale set to a non-default language

Current behavior:

  • The help text for each option is in the default language

New behavior:

  • The output is translated (except the initial paragraph which has no translations)

- Localization culture is set from multiple threads on the server, so use current local context for every new call instead of global context
- Change locale before executing help commands if flag is present
- When force-locale is set, also change locale for log messages

Closes duplicati#4176
@kenkendk kenkendk merged commit bda368f into duplicati:master May 13, 2024
4 checks passed
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.

force-locale option does not work
2 participants