1
0
Fork 0

wip(lab): Work on i18n-next

This commit is contained in:
Joost De Cock 2022-02-08 20:49:19 +01:00
parent 491913e288
commit 4c17255a58
26 changed files with 170 additions and 105 deletions

View file

@ -1,9 +1,12 @@
import { useTranslation } from 'next-i18next'
const Text = (props) => {
const { t } = useTranslation(['app'])
let text = []
// Handle translation
let translated = ''
for (let string of props.point.attributes.getAsArray('data-text')) {
translated += props.app.t(string.toString(), false, props.locale).replace(/"/g, '"') + ' '
translated += t(string.toString()).replace(/"/g, '"') + ' '
}
// Handle muti-line text
if (translated.indexOf('\n') !== -1) {