spacedrive/interface/app/route-schemas.ts
Artsiom Voitas 2d78edef4d
Added even more i18n translation keys (#2453)
* more translation keys

* added i18n keys for future ObjectKindEnum translation

* more keys

* added more keys

* synced all new translation keys with all languages, translated keys on Belarusian and Russian

* added translation for objectkinds in overview

* added translation function for objectkinds

* added more keys to german locale

* renamed 'asc' and 'desc' keys

* rolled back changes

* added missed key

* there are much more keys, than you can imagine

* fixed misspelling

* removed console.log

* removed function "pluralize", added required plural words keys for each language

* fixed condition, which could've lead to undefined value

* hide filter description for boolean filters
2024-05-04 16:16:49 +00:00

48 lines
1.8 KiB
TypeScript

import { z } from '@sd/ui/src/forms';
import i18n from './I18n';
export const SortOrderSchema = z.union([
z.literal('Asc').describe(i18n.t('ascending')),
z.literal('Desc').describe(i18n.t('descending'))
]);
export type SortOrder = z.infer<typeof SortOrderSchema>;
export const NodeIdParamsSchema = z.object({ id: z.string() });
export type NodeIdParams = z.infer<typeof NodeIdParamsSchema>;
export const LibraryIdParamsSchema = z.object({ libraryId: z.string().optional() });
export type LibraryIdParams = z.infer<typeof LibraryIdParamsSchema>;
export const LocationIdParamsSchema = z.object({ id: z.coerce.number() });
export type LocationIdParams = z.infer<typeof LocationIdParamsSchema>;
export const TagsSettingsParamsSchema = LocationIdParamsSchema.extend({
id: LocationIdParamsSchema.shape.id.optional()
});
export type TagsSettingsParams = z.infer<typeof TagsSettingsParamsSchema>;
export const PathParamsSchema = z.object({ path: z.string().optional() });
export type PathParams = z.infer<typeof PathParamsSchema>;
export const SearchIdParamsSchema = z.object({ id: z.coerce.number() });
export type SearchIdParams = z.infer<typeof SearchIdParamsSchema>;
export const SearchParamsSchema = PathParamsSchema.extend({
// take: z.coerce.number().default(100),
// order: z
// .union([
// z.object({ field: z.literal('name'), value: SortOrderSchema }),
// z.object({ field: z.literal('dateCreated'), value: SortOrderSchema })
// // z.object({ field: z.literal('sizeInBytes'), value: SortOrderSchema })
// ])
// .optional(),
search: z.string().optional()
});
export type SearchParams = z.infer<typeof SearchParamsSchema>;
export const ExplorerParamsSchema = PathParamsSchema.extend({
take: z.coerce.number().default(100)
});
export type ExplorerParams = z.infer<typeof ExplorerParamsSchema>;