robisim74/qwik-speak

Dynamic key works on dev but not in production

juanpmarin opened this issue · 6 comments

Hi! I'm trying to get translation using a dynamic key, like this:
https://github.com/juanpmarin/qwik-speak-repro/blob/0d0e053b1f92e08c3d7ca495b3926dda60b4ccee/src/components/list/list.tsx#L13

It works in development but no in production, you can see the bug here:
https://qwik-speak-repro.pages.dev/test/

If you press the Add item button, translation stop working

juanpmarin/qwik-speak-repro@00bcd6a

@robisim74 I've added runtime assets property and the bug still happens:
https://qwik-speak-repro.pages.dev/test/

You are adding app asset twice: once in configuration as runtimeAssets, once as assets in https://github.com/juanpmarin/qwik-speak-repro/blob/master/src/routes/(internal)/layout.tsx

So you have to decide: either app asset is shared by the whole app, or it's by scope.

That said, you should put only the keys you need in the runtime files, because they degrade performance if overused.

@robisim74 translations with parameters like this one shipments.order.recipient@@Envío para {{recipient}} should be in runtime assets too?

No. When you run the build for production, you will find translations with dynamic keys in qwik-speak-inline.log