react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

translation not working inside of PDF document

Open Hiiiij opened this issue 3 years ago • 2 comments

Describe the bug I'm using gatsby and react-i18n for translation along with react-pdf/renderer's PDFViewer component, however the translation is missing within PDFViewer / iframe and only the translation keys are rendered instead, it seems to work properly however outside

To Reproduce Steps to reproduce the behavior including code snippet (if applies):

  1. Go to https://github.com/Hiiiij/gatsby-pdf
  2. run npm install
  3. run `npm start'

Expected behavior intro key within the rendered / downloaded PDF should show the translated text as set in translation.json

Current behavior only translation key is rendered instead

Hiiiij avatar Feb 26 '22 18:02 Hiiiij

Yeah, experiencing the same issue right now

Edit: Small followup, for me the issue was not with react-pdf, but with a simple .use(HttpApi) call in the i18n-next configuration, see: https://github.com/i18next/i18next-http-backend

pascalporedda avatar Mar 11 '22 13:03 pascalporedda

Any example for using useTranslation on /api/ route endpoints with Next.js?

I tried import { i18n } from 'next-i18next';

but i18n?.init() always returns null

@pascalporedda @Hiiiij

sagargulati avatar Jul 20 '22 21:07 sagargulati