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

[5.x] Implement translations for dictionary keys used in titles shown in breadcrumb trails #10039

Merged
merged 2 commits into from
May 10, 2024

Conversation

peimn
Copy link
Contributor

@peimn peimn commented May 10, 2024

No description provided.

@@ -37,7 +37,8 @@ public function jsonSerialize()

public function title($title = null)
{
$crumbs = $this->crumbs->map->text;
$new_crumbs = $this->crumbs->map(fn ($v) => ['text' => __($v['text']), 'url' => $v['url']]);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe simplify to $crumbs = $this->crumbs->map(fn ($v) => __($v['text'])) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice!

@jasonvarga
Copy link
Member

What page is this an issue on?

@peimn
Copy link
Contributor Author

peimn commented May 10, 2024

What page is this an issue on?

This title is automatically generated for all pages and displays the path. For example, if a page is opened from a collection, the title of the page will be Statamic > collections > pages > Main Page.

If a key, such as dictionary.pages, is used for the title, it will appear in the breadcrumb trail exactly as it is.

This change will translate the title.

@jasonvarga
Copy link
Member

But where are you seeing this long breadcrumb? On an entry, it's just < Collection name

CleanShot 2024-05-10 at 16 06 31

@jasonvarga
Copy link
Member

Ah the <title> duh! 😆

@jasonvarga jasonvarga merged commit a258983 into statamic:5.x May 10, 2024
16 checks passed
@peimn peimn deleted the fix/breadcrumbs-keyed-titles branch May 10, 2024 21:13
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.

3 participants