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

Allow Language Selection on the Toolbar #1703

Merged

Conversation

leandrodesouzadev
Copy link
Contributor

closes #991

Added a new optional setting TOOLBAR_LANGUAGE that can be set by a user to define in which language the toolbar is displayed.
Modified the render_toolbar method from DebugToolbar class to use the django.utils.translations.override, so the language is set either: To the defined language on the TOOLBAR_LANGUAGE or the current language (No breaking changes). After the template is rendered, the language is set back to the previous.

Added two tests cases:
One that checks if the toolbar is rendered accordingly when this setting was not defined, the default behavior.
Other that checks if the toolbar was rendered to the set language.

Updated documentation on configuration.rst on how to set this value.

Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

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

I'm good with this as is.

Allows users to define the language that the toolbar will be rendered using the new settings `TOOLBAR_LANGUAGE`

Adds test cases to TOOLBAR_LANGUAGE setting

Removes trailing setting on example project
@tim-schilling
Copy link
Contributor

Squashed your commits.

@tim-schilling tim-schilling merged commit d9b25f2 into jazzband:main Nov 12, 2022
@amureki amureki mentioned this pull request Dec 7, 2022
2 tasks
matthiask added a commit that referenced this pull request Jan 16, 2023
* Use correct language in panels

PR #1703 introduced a bug where SQLPanel (and probably others) is rendered in `LANGUAGE_CODE` language, while it should use `TOOLBAR_LANGUAGE` if provided.
This PR fixes panel's content language.

* Add missing changelog entries

* Use code formatting and include more details on the recent change.

* Create decorator to use TOOLBAR_LANGUAGE in toolbar specific views.

This reviews the third-party panel documentation to reference
these two decorators and explain them. They aren't necessary
but should be used.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tim Schilling <schillingt@better-simple.com>
Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
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.

Toolbar language selection
3 participants