The CreatorCon Call for Content is officially open! Get started here.

Custom component with library-translate not working

Ruhtra
Tera Contributor

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 : 

Capture d’écran 2025-10-03 à 10.48.03.png

In development mode, it displays my key (it doesn't translate).

Capture d’écran 2025-10-03 à 10.41.34.png

But after deploying my component, it totally breaks with an error in the console ; 

Capture d’écran 2025-10-03 à 10.44.22.png

Capture d’écran 2025-10-03 à 10.44.48.png

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 ?

3 REPLIES 3

mayankkumar
Kilo Patron
Kilo Patron

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

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.

Okay @Ruhtra, I will look into it again and let you know if found something helpful.