Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
uses: plone/meta/.github/workflows/test.yml@main
coverage:
uses: plone/meta/.github/workflows/coverage.yml@main
dependencies:
uses: plone/meta/.github/workflows/dependencies.yml@main
release_ready:
uses: plone/meta/.github/workflows/release_ready.yml@main

Expand Down
3 changes: 1 addition & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
# See the inline comments on how to expand/tweak this configuration file
[meta]
template = "default"
commit-id = "d03b196d"
commit-id = "18642aac"

[github]
jobs = [
"qa",
"test",
"coverage",
"dependencies",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would simply add the two missing dependencies to setup.py: Acquisition and plone.app.layout.
Actually, Acquisition would not be needed if we call super; see my next comment.

"release_ready",
]
2 changes: 2 additions & 0 deletions news/3.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Override `@@plone_portal_state/language` to fix `mockup` translations.
[petschki]
23 changes: 23 additions & 0 deletions src/cs/adminlanguage/browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from Acquisition import aq_inner
from cs.adminlanguage.negotiator import get_editor_language
from cs.adminlanguage.negotiator import logger
from plone.app.layout.globals.portal import PortalState as PortalStateBase


class PortalState(PortalStateBase):

def language(self):
try:
language = get_editor_language(self.request)
if language:
return language
except Exception as e:
# Some defensive programming here
logger.error("Admin language force patch failed")
logger.exception(e)

return (
self.request.get("LANGUAGE", None)
or aq_inner(self.context).Language()
or self.default_language()
)
Comment on lines +19 to +23

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would just call the super method:

Suggested change
return (
self.request.get("LANGUAGE", None)
or aq_inner(self.context).Language()
or self.default_language()
)
return super().language()

And then we can remove the Acquisition import.

10 changes: 10 additions & 0 deletions src/cs/adminlanguage/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,14 @@

<!-- -*- extra stuff goes here -*- -->

<!-- plone_portal_state override -->
<browser:page
name="plone_portal_state"
for="*"
class=".browser.PortalState"
allowed_interface="plone.app.layout.globals.interfaces.IPortalState"
permission="zope.Public"
layer=".interfaces.ICsAdminlanguageLayer"
/>

</configure>