2023-09-02 15:37:04 +02:00
|
|
|
const projectTypeMessages = defineMessages({
|
|
|
|
|
datapack: {
|
|
|
|
|
id: 'project-type.datapack.singular',
|
|
|
|
|
defaultMessage: 'Data Pack',
|
|
|
|
|
},
|
|
|
|
|
datapacks: {
|
|
|
|
|
id: 'project-type.datapack.plural',
|
|
|
|
|
defaultMessage: 'Data Packs',
|
|
|
|
|
},
|
|
|
|
|
mod: {
|
|
|
|
|
id: 'project-type.mod.singular',
|
|
|
|
|
defaultMessage: 'Mod',
|
|
|
|
|
},
|
|
|
|
|
mods: {
|
|
|
|
|
id: 'project-type.mod.plural',
|
|
|
|
|
defaultMessage: 'Mods',
|
|
|
|
|
},
|
|
|
|
|
modpack: {
|
|
|
|
|
id: 'project-type.modpack.singular',
|
|
|
|
|
defaultMessage: 'Modpack',
|
|
|
|
|
},
|
|
|
|
|
modpacks: {
|
|
|
|
|
id: 'project-type.modpack.plural',
|
|
|
|
|
defaultMessage: 'Modpacks',
|
|
|
|
|
},
|
|
|
|
|
plugin: {
|
|
|
|
|
id: 'project-type.plugin.singular',
|
|
|
|
|
defaultMessage: 'Plugin',
|
|
|
|
|
},
|
|
|
|
|
plugins: {
|
|
|
|
|
id: 'project-type.plugin.plural',
|
|
|
|
|
defaultMessage: 'Plugins',
|
|
|
|
|
},
|
|
|
|
|
resourcepack: {
|
|
|
|
|
id: 'project-type.resourcepack.singular',
|
|
|
|
|
defaultMessage: 'Resource Pack',
|
|
|
|
|
},
|
|
|
|
|
resourcepacks: {
|
|
|
|
|
id: 'project-type.resourcepack.plural',
|
|
|
|
|
defaultMessage: 'Resource Packs',
|
|
|
|
|
},
|
|
|
|
|
shader: {
|
|
|
|
|
id: 'project-type.shader.singular',
|
|
|
|
|
defaultMessage: 'Shader',
|
|
|
|
|
},
|
|
|
|
|
shaders: {
|
|
|
|
|
id: 'project-type.shader.plural',
|
|
|
|
|
defaultMessage: 'Shaders',
|
|
|
|
|
},
|
2023-12-06 12:21:14 +11:00
|
|
|
project: {
|
|
|
|
|
id: 'project-type.project.singular',
|
|
|
|
|
defaultMessage: 'Project',
|
|
|
|
|
},
|
|
|
|
|
projects: {
|
|
|
|
|
id: 'project-type.project.plural',
|
|
|
|
|
defaultMessage: 'Projects',
|
|
|
|
|
},
|
2023-12-27 13:27:50 -05:00
|
|
|
collection: {
|
|
|
|
|
id: 'project-type.collection.singular',
|
|
|
|
|
defaultMessage: 'Collection',
|
|
|
|
|
},
|
|
|
|
|
collections: {
|
|
|
|
|
id: 'project-type.collection.plural',
|
|
|
|
|
defaultMessage: 'Collections',
|
|
|
|
|
},
|
2023-09-02 15:37:04 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
type ExtractSingulars<K extends string> = K extends `${infer T}s` ? T : never
|
|
|
|
|
|
|
|
|
|
type ProjectType = ExtractSingulars<keyof typeof projectTypeMessages>
|
|
|
|
|
|
|
|
|
|
export function getProjectTypeMessage(type: ProjectType, plural = false) {
|
2023-12-06 12:21:14 +11:00
|
|
|
return (
|
|
|
|
|
projectTypeMessages[`${type}${plural ? 's' : ''}`] ??
|
|
|
|
|
projectTypeMessages[`project${plural ? 's' : ''}`]
|
|
|
|
|
)
|
2023-09-02 15:37:04 +02:00
|
|
|
}
|