I18n-js

I18n-js is a library for loading a script's messages, stored as JSON, ready for said script to use. Not only does it allow messages to be split out of the main code containing all the logic, it handles language fallbacks as well.

Usage
To use I18n-js, import MediaWiki:I18n/code.js into your script. Then pass the name of your script to  which returns a promise: