@drincs/pixi-vn-ink
Version:
Pixi'VN gives you the ability to write your own narrative using Ink
42 lines (39 loc) • 1.47 kB
TypeScript
import { PixiVNJsonLabelStep, PixiVNJson } from '@drincs/pixi-vn-json';
/**
* This function set the function to translate the text
* @param t The function to translate the text
* @example
* ```ts
* import { onInkTranslate } from 'pixi-vn-ink'
* import { useTranslation } from "react-i18next";
*
* const { t } = useTranslation(["narration"]);
* onInkTranslate((text) => {
* return t(text)
* })
* ```
*/
declare function onInkTranslate(t: (text: string) => string): void;
/**
* Generate a json object with the keys of the labels and the values of the text to be translated
* @param labels The labels to be used in the narrative. They will be added to the system
* @param json If you want to add more keys to the existing json
* @param options The options to set the default value if the key is not found
* @returns The json object with the keys of the labels and the values of the text to be translated
* @example
* ```ts
* import { generateTranslateJson, importInkText } from 'pixi-vn-ink'
*
* importInkText( your_ink_text_here ).then((labels) => {
* let json = generateTranslateJson(labels)
* })
* ```
*/
declare function generateJsonInkTranslation(labels: PixiVNJsonLabelStep[] | PixiVNJson, json?: object, options?: {
/**
* Default value to set if the key is not found
* @default "empty_string"
*/
defaultValue?: "empty_string" | "copy_key";
}): object;
export { generateJsonInkTranslation, onInkTranslate };