mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Fix #297 improve fake name translation and fix crash
This commit is contained in:
@@ -53,6 +53,10 @@ export function ItemTooltip({ id, tag, advanced, offset = [0, 0], swap }: Props)
|
||||
}
|
||||
|
||||
function fakeTranslation(str: string) {
|
||||
const raw = str.replace(/minecraft:/, '').replaceAll('_', ' ')
|
||||
return raw[0].toUpperCase() + raw.slice(1)
|
||||
const colon = str.indexOf(':')
|
||||
return str.slice(colon + 1)
|
||||
.replace(/[_\/]/g, ' ')
|
||||
.split(' ')
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user