Modrinth/utils/i18n-project-type.ts
Geometrically 3a735ea0ce
New collections (#1484)
* [WIP] Transfer collections to own branch

* fixes

* rewrite js

* Add visibility dropdown to collection edit modal

* Add visibility badges to collection page

* Update visibility options and icons in collection
page

* Add delete functionality to collection modal

* Collection project deletion flow

* remove "visit project" button on overflow

* Remove via checklist not individually

* Update manage title in settings.vue

* remove collections from settings page

* hook up collections page

* collection header to look like project header

* Refactor layout.scss and collections.vue

* fix omorphia

* Update

* Conform collections to old design structure

* Update navigation links and remove unused code

* Add collection view and collections to user page

* Refactor user project display logic

* Add collection creation functionality and update profile labels

* Add function calls to initialize user collections

* Refactor collection page layout and functionality

* Add initialization of user collections in create function

* Fix styling issue in collection page

* Update collection status to private

* remove name

* Refactor card component and update grid layout

* Finish collections

---------

Co-authored-by: Carter <safe@fea.st>
2023-12-27 13:27:50 -05:00

78 lines
1.8 KiB
TypeScript

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',
},
project: {
id: 'project-type.project.singular',
defaultMessage: 'Project',
},
projects: {
id: 'project-type.project.plural',
defaultMessage: 'Projects',
},
collection: {
id: 'project-type.collection.singular',
defaultMessage: 'Collection',
},
collections: {
id: 'project-type.collection.plural',
defaultMessage: 'Collections',
},
})
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) {
return (
projectTypeMessages[`${type}${plural ? 's' : ''}`] ??
projectTypeMessages[`project${plural ? 's' : ''}`]
)
}