satnaing / astro-paper

A minimal, accessible and SEO-friendly Astro blog theme
https://astro-paper.pages.dev/
MIT License
2.12k stars 440 forks source link

How replace «Tags» word in Breadcrumbs? #282

Closed AliIslamov closed 3 months ago

AliIslamov commented 3 months ago

I'm working for full translation my Astro Paper to russian language.

When I visit one of the tags page I see in breadcrumbs:

Main » Tags » tag

I know where translate «Main» and every tag I write in my language initially. But I can't find the way to replace middle inscription «Tags» on russian translated word.

Where can I do it?

AliIslamov commented 3 months ago

I have solved the problem myself.

Change in file breadcrumbs.astro line 42

From:


{decodeURIComponent(breadcrumb)}

To:


{replaceBreadcrumbs(breadcrumb)}

And line 47

From:


<a href={/${breadcrumb}/}>{breadcrumb}</a>

To:


<a href={/${breadcrumb}/}>{replaceBreadcrumbs(breadcrumb)}</a>

And also past in script section function:


const replaceBreadcrumbs = (breadcrumb) => {
  switch (breadcrumb) {
    case 'tags':
      return 'тэги';
    case 'about':
      return 'о нас';
    case 'search':
      return 'поиск';
    default:
      return decodeURIComponent(breadcrumb);
  }
}