fix(editor): plurals, trimmed names, default tab, parent drawing confirmation

This commit is contained in:
bchanot committed 2026-11-04 19:40:43 +01:00
1 parent b42c6ae844
commit be4f468790
35 files changed
+385 -63

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import { useT } from '@/i18n/useT'
import { useLocaleStore } from '@/state/localeStore'
import type { Locale } from '@/i18n/types'
/** `<key>_one` or `<key>_other` by the locale's plural rule (fr: 0 and 1 are singular). */
export function pluralKey(locale: Locale, key: string, count: number): string {
const category = new Intl.PluralRules(locale).select(count)
return `${key}_${category === 'one' ? 'one' : 'other'}`
}
/** A count phrase: picks the plural form of `key` and fills `{count}`. */
export function usePlural(): (key: string, count: number) => string {
const t = useT()
const locale = useLocaleStore((s) => s.locale)
return (key, count) =>
t(pluralKey(locale, key, count)).replace('{count}', String(count))
}