diff --git a/package.json b/package.json index 73d57e2..ad6eec7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.9.1", + "version": "2.9.2", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/components/blocks/Block.tsx b/src/components/blocks/Block.tsx index 7bc0a6b..577e09f 100644 --- a/src/components/blocks/Block.tsx +++ b/src/components/blocks/Block.tsx @@ -3,6 +3,7 @@ import classNames from "classnames"; import { getEnglishFromRendered, } from "../../lib/phrase-building/np-tools"; +import { getEnglishPersonInfo } from "../../library"; function Block({ opts, block }: { opts: T.TextOptions, @@ -219,7 +220,13 @@ export function NPBlock({ opts, children, inside, english }: { {np.selection.adjectives}
{np.selection.ps[0].f}
-
NP
+
+ NP + {!inside ? <> + {` `} + ({getEnglishPersonInfo(np.selection.person, "short")}) + : <>} +
{english} } diff --git a/src/lib/misc-helpers.ts b/src/lib/misc-helpers.ts index 8ddc093..8b4623e 100644 --- a/src/lib/misc-helpers.ts +++ b/src/lib/misc-helpers.ts @@ -147,15 +147,20 @@ export function personIsPlural(person: T.Person): boolean { return person > 5; } -export function getEnglishPersonInfo(person: T.Person): string { - const p = [0,1,6,7].includes(person) - ? "1st pers" +export function getEnglishPersonInfo(person: T.Person, version?: "short" | "long"): string { + const p = ([0,1,6,7].includes(person) + ? "1st" : [2,3,8,9].includes(person) - ? "2nd pers" - : "3rd pers"; - const a = personIsPlural(person) ? "plur" : "sing"; - const g = personGender(person); - return `${p}. ${a}. ${g}.`; + ? "2nd" + : "3rd") + (version !== "short" ? " pers." : ""); + const number = personIsPlural(person) ? "plur" : "sing"; + const n = version === "short" + ? (number === "plur" ? "pl" : "sn") : number; + const gender = personGender(person); + const g = version === "short" + ? (gender === "masc" ? "m" : "f") + : gender; + return `${p} ${n}. ${g}.`; } export function randomNumber(minInclusive: number, maxExclusive: number): number {