Custom component with library-translate not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hello everyone,
I don't know if this post is in the right forum, but we are currently facing an issue while developing a custom component and using the "library-translate" package (in 19.1.0).
We are using it following the documentation in Zurich ; https://developer.servicenow.com/dev.do#!/reference/next-experience/zurich/ui-framework/recipes/tran...
I created a sys_ui_message with a key "test.my.message" on my instance ; installed the package in my project, imported the function "t" and using it in my code like that :
In development mode, it displays my key (it doesn't translate).
But after deploying my component, it totally breaks with an error in the console ;
The error is coming from the "library-translate" package itself.
Maybe I am using it wrong, but I can't find resources or examples on how to use it.
Do you have some resources or examples to fix this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago - last edited 4 hours ago
Hi @Ruhtra,
You can try Component Builder provided by ServiceNow OOB from Zurich Release
refer this -> Create custom components to reuse across pages with component builder
and there's CLI approach, you can refer this tutorial video -> Checklist Tutorial - ServiceNow Next UI Custom Component Development
other useful resources -> Creating Custom Components – ServicePortal.io
-----------------------------------------------------------------------------------------------------------------------------------------
Please mark my response helpful and accept as solution
Thanks & Regards
Mayank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello @mayankkumar, thanks for your reply.
Unfortunately, these resources do not cover the translation of a text.
We already know how to build and deploy a component. Our problem is only focused on translating labels in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Okay @Ruhtra, I will look into it again and let you know if found something helpful.