Dynamically load string at runtime #174
-
First of all: Thank you for this great package! (Warning: I am a complete beginner at this.) My question is: How do I access a translation if I know only at runtime which translation I want to grab? For context: I use SvelteKit to build a personal blog. Each blog post has a list of categories / topics attached to it and I'd like to translate these categories. Currently, I load my translations like this:
So this works well when I know which string I want to load. However, since the categories / topics are different for each blog posts, I don't know how to load the corresponding string. This is what I've tried:
Both approaches produce no output even when the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Found the answer! Sometimes it helps to try to explain something to someone else :) So this works:
|
Beta Was this translation helpful? Give feedback.
Found the answer! Sometimes it helps to try to explain something to someone else :)
So this works: