mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-29 09:32:43 +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) {
|
function fakeTranslation(str: string) {
|
||||||
const raw = str.replace(/minecraft:/, '').replaceAll('_', ' ')
|
const colon = str.indexOf(':')
|
||||||
return raw[0].toUpperCase() + raw.slice(1)
|
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