How to get formatted translation from javascript?
-
Hi!
I would like to retrieve a formatted translation like
Hi %s, welcome back!
from the javascript code, I've been looking around thetranslator.js
API but I couldn't find a way to retrieve a formatted string and I don't have a clue how to get only the string (to format it myself). Any hints? I know I'm missing something here, maybe I didn't drink enough coffee today?F.
-
To get the current language, execute
translator.getLanguage()
. Fallbacks are automatically handled by the translation engine, so even a language with no translations forerror.json
, for example, will have an english version of that file in its translations folder.
Copyright © 2024 NodeBB | Contributors