Languages Module

Andrew Start edited this page Jun 5, 2015 · 3 revisions

The Languages Module provides assistance in managing language specific assets.



In order to use the Languages Module, make sure to include the module's JavaScript file within the <head> tag of your HTML file. The module needs to be included after the core.

<script src="components/springroll/dist/core.min.js"></script>
<script src="components/springroll/dist/modules/languages.min.js"></script>


// Reference to your app (should already be created)
var app = new springroll.Application();

// Load up or create the locale configuration data
var config = {

app.on('init', function()
	// Create the Language object

	// Set the language, if desired (already set to the browser preferences)

	// load an asset - the replace value will be replaced with the current locale id

When setting the language, you can use a single locale id, or an array of locale ids in order of preference. Language will check each id to see if the configuration says it is supported, and will also check to see if a general version of a language is supported if a specific dialect is not.

// This will set the language to "es", as a fallback from "es-mx"
this.languages.setLanguage(["es-mx", "en-gb"]);

If no requested language is supported, the default will be used, as specified in the configuration data.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.