You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the component in a project in wich I need to show the titles with each Word capitalized. The titles are in german and I need therefore use the attribute "replaceCharacterList" to revert the typical transliterated characters ae => ä, ue => ü ,etc.
To capitalize each word I use "transformLabel", but then the option "replaceCharacterList" doesn't work anymore.
Problem:
I'm using the component in a project in wich I need to show the titles with each Word capitalized. The titles are in german and I need therefore use the attribute "replaceCharacterList" to revert the typical transliterated characters ae => ä, ue => ü ,etc.
To capitalize each word I use "transformLabel", but then the option "replaceCharacterList" doesn't work anymore.
To Reproduce
Visited url: "http://site.url/der-einheitliche-ansprechpartner-nrw/ueber-uns"
<Breadcrumbs
useDefaultStyle={false}
containerClassName={styles.breadcrumbs}
listClassName={styles.breadcrumbs}
rootLabel='Home'
replaceCharacterList={[
{ from: '-', to: ' ' },
{ from: '_', to: ' ' },
{ from: 'ae', to: 'ä' },
{ from: 'oe', to: 'ö' },
{ from: 'ue', to: 'ü' },
]}
transformLabel={(title) => {
return title.replace(/(^.{1})|(\s+.{1})/g, (letter) => letter.toUpperCase())
}}
/>
Expected Result
Home > Der Einheitliche Ansprechpartner Nrw >Über uns
Given Result
Home > Der-Einheitliche-Ansprechpartner-Nrw > Ueber-uns
Until now I've used the follow workaround:
transformLabel={(title) => {
return title
.replaceAll('-', ' ')
.replaceAll('_', ' ')
.replaceAll('ae', 'ä')
.replaceAll('oe', 'ö')
.replaceAll('ue', 'ü')
.replace(/(^.{1})|(\s+.{1})/g, (letter) => letter.toUpperCase())
}}
Is it possible to use both "transformLabel" and "replaceCharacterList" at the same time?
It would be nice to have this useful option available.
Thanks in advance.
The text was updated successfully, but these errors were encountered: