How translate ink text?
As explained in more detail here, Pixi’VN gives the possibility to translate the game text using a library, such as i18next. Also in ink + Pixi’VN integration you can use a library to translate the text of the ink.
Pixi’VN gives the developer the ability to intercept the translation event with the onInkTranslate
function.
The onInkTranslate
function has as a parameter a callback function takes as parameter the text to translate and returns the translated text.
import { onInkTranslate } from '@drincs/pixi-vn-ink'
import { useTranslation } from "react-i18next";
const { t } = useTranslation(["narration"]);
onInkTranslate((text) => {
return t(text)
})
=== start ===
Hello, my name is [joe]
-> DONE
import { useI18n } from './i18n';
export default function App() {
useI18n()
return (
// ...
);
}
{
"narration": {
"Hello, my name is [joe]": "Hola, mi nombre es [joe]"
// ...
}
}
Auto-generation of translation files
( Under development )