Yes, I believe you either need to do this, or alter the jstree.js file itself to change references to jQuery to just use global (as in, don't require jQuery at all)
Accessing a property defined in languages (internationalization) from client-side JS
-
Right, and I'm asking why you are translating these strings yourself in the first place.
-
Simply because of internationalization. Right now, I am targeting en-GB only. Later on, may be, we need to support 'n' different number of languages. So my map.js (client side) will remain untouched.
-
That's not what I'm asking. I'm asking why you want to do the parsing of the translations manually instead of using the automatic translation that NodeBB does.
-
I am not aware of this automatic translation. Could you pl. write an example about how this can be achieved, in my case, global:my_location.
-
Please provide the code where you use these translations. It depends on what you're doing.
-
require(['translator'], function (translator) { translator.translate('[[map:my_location]]', function (translated) { my_location = translated; }); }); .... marker = L.marker(initialLocation, { draggable: true, title: my_location, alt: my_location, riseOnHover: true }).addTo(map) .bindPopup(initialLocation.toString()).openPopup();
-
Ok so this is one of the rare cases where manually translating is your only option.
If you want to get a bunch of translations, I'd suggest using a filename besides
global.json
, maybe usemap.json
instead. Then, you can do this:require(['translator'], function (translator) { translator.getTranslations(translator.getLanguage(), 'map', function (translations) { translations.my_location === 'My Location'; }); });
Also, please use code blocks from now on. It works like this:
``` // code goes here ```
-
Great! I understand
btw where to use the code blocks?
-
Use code block when you make a post with code in it
-
oh.. Right