portal_tabs translations do not seem to work for @navigation endpoint.

Open
#1,937 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start in src/plone/restapi/services/navigation/get.py, focusing on how portal_tabs entries are converted into navigation responses and when the Home tab translation branch is reached. Verify the @navigation endpoint with a translated portal and ensure the Home tab title is translated in the response.

Written by the indexing model from the issue text.

Description

Hello, in here

https://github.com/plone/plone.restapi/blob/main/src/plone/restapi/services/navigation/get.py

we have the following snippet:

        for tab in self.portal_tabs:
            entry = {}
            entry.update(
                {
                    "path": "/".join((navtree_path, tab["id"])),
                    "description": tab["description"],
                    "@id": tab["url"],
                }
            )
            if "review_state" in tab:
                entry["review_state"] = json_compatible(tab["review_state"])
            else:
                entry["review_state"] = None

            if "title" not in entry:
                entry["title"] = tab.get("name") or tab.get("description") or tab["id"]
            else:
                # translate Home tab
                entry["title"] = translate(
                    entry["title"], domain="plone", context=self.request
                )

            entry["title"] = safe_text(entry["title"])
            ret[navtree_path].append(entry)

To me it seems we can never reach the "translate" path so in Volto the "Home" tab does not get translated.

Best,
Erkka

Dominant language
Python
Stars
109
Forks
107
Avg merge
2d 3h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from plone/plone.restapi

All issues in plone/plone.restapi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.