How to use translations

Hi there, I have a question regarding translation support in novu. I uploaded a translation file with just the content '{"test_key": "Test Translation"}'. How can I actually use the translations in the template editor of an in-app notification for example? And how can we include specific novu variables such as the digest step total count, can this be included in the translation value?
21 Replies
Pawan Jain
Pawan Jain5mo ago
Hi @L.Wuethrich We are still working on the translation feature it will be available with next release
Gali Baum
Gali Baum5mo ago
Hi @L.Wuethrich, if you have a translation group named test with a file with content {"test_key": "Test Translation"}
In the editor you could use it like that: {{i18n "test.test_key"}} To include variables inside a translation result you can first define a variable as part of the translation string. For example {"test_key": "Test Translation {{yourVar}}"} and then when you use it in the editor you would do: {{i18n "test.test_key" yourVar=step.total_count}} Where in the yourVar=<HERE>. HERE could also be a variable that you pass its value through the payload
Pawan Jain
Pawan Jain5mo ago
Thanks Gali 🫡
L.Wuethrich
L.Wuethrich5mo ago
@Gali Baum Thanks for your help, what if there are multiple values can i just add them with spaces one after the other? I am not sure what I am doing wrong but using the given example it only includes 'test_key' in the output message and not the translated value
Gali Baum
Gali Baum5mo ago
does your subscriber 'locale' field has the same locale as the one you defined for the file in the translation settings?
L.Wuethrich
L.Wuethrich5mo ago
I thought that would not matter as I had to provide a default within the ui as a fallback
Gali Baum
Gali Baum5mo ago
Thats a good point. Could you please try with the same locale for the subscriber? and I'll look into that Just ti make sure that is really the problem 🙂
L.Wuethrich
L.Wuethrich5mo ago
Yes let me check
Novu_Bot
Novu_Bot5mo ago
@L.Wuethrich, you just advanced to level 1!
L.Wuethrich
L.Wuethrich5mo ago
@Gali Baum it does not seem to work for me even after changing my locale
Gali Baum
Gali Baum5mo ago
Can you send me a screenshot of your editor> ?
L.Wuethrich
L.Wuethrich5mo ago
No description
L.Wuethrich
L.Wuethrich5mo ago
my group is named translations
L.Wuethrich
L.Wuethrich5mo ago
No description
L.Wuethrich
L.Wuethrich5mo ago
No description
L.Wuethrich
L.Wuethrich5mo ago
I know I have the group twice but both have the same file as input and I can't remove the second one and the second one got a different id
Gali Baum
Gali Baum5mo ago
and what is your output in the notification? translation: test_key ?
L.Wuethrich
L.Wuethrich5mo ago
I have a custom component but only the translation key seems to be in the output
No description
L.Wuethrich
L.Wuethrich5mo ago
@Gali Baum Please write back if you find out what's the problem
Gali Baum
Gali Baum5mo ago
Sure thing @L.Wuethrich , I’ll look into it first thing tomorrow morning 👍 I’ll keep you updated @L.Wuethrich I was not able to reproduce this, for me it happens as expected could you please send me a dm with your organizationId?
Gali Baum
Gali Baum5mo ago
@L.Wuethrich Could you please try sending an email through the test workflow feature?
No description