@PitaJ Thanks!
alt text
Hi!
I would like to retrieve a formatted translation like Hi %s, welcome back!
from the javascript code, I've been looking around the translator.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.
Not quite sure we have a method to do that, since it's never been an issue for us... you can grab the raw JSON files from /languages
, though...
Thank you @julian
What is the good way to get the current language in use?
The good behaviour is to get the current language and if the json file is empty, retrieve the en_GB (default) one?
To get the current language, execute translator.getLanguage()
. Fallbacks are automatically handled by the translation engine, so even a language with no translations for error.json
, for example, will have an english version of that file in its translations folder.
Thanks for your help @julian !