Lang strings to javascript, make my module js lang aware

SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
I have a module, ujLifeStreams, which is using a jquery plugin with a fair bit of lang (english) coded into the many js files. (the many lang string options for "posted to facebook", "created a marketplace item on jamroom.net", "updated wikipedia", etc)

I'd like to make the module fully translateable and get the lang strings into the ACP. At the moment I think that my best way forward is to write a js language array to the javascript_footer_function and change the jquery plugin js to use those variables, it looks possible.

Are there any shortcuts towards doing this (I haven't noticed any but always worth asking) or is there anything existing I should look at which might show a better way?

Thanks for the feeds out of jamroom.net - I was sure they'd be there and bingo, they were. Perfect.

Gratuitous screenshot alert, but notice the jamroom.net service in the middle. A jamroom.net profile is now a peer to a fb, twitter, github profile, etc. Which I think is pretty cool, and worth a mention :)
lifestream-icons.png
lifestream-icons.png  •  124KB




--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 04/08/14 12:06:33PM
brian
@brian
11 years ago
10,149 posts
Very cool Steve - I like it ;)

The way you've indicated should work great - it's not something we've had to do yet in our modules - for the most part if there is language/content to be shown to the user we've opted for a template pulled in via an AJAX call, and if there is an error we've left that in English to help with support requests.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
Ok thanks Brian, I'll give that a try.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

Tags