Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by nutbutter

Hello all,

So impact.js is just pure awesome! To make it better, I thought that I would share my localization code.

create a new file in lib/game/lang/load.js
with the following code:
ig.module( 'game.lang.load' )
.defines(function(){

enUS={
	"MainMenu":[{
		"Start": "Start",
		"Options": "Options",
		"Exit": "Exit"
	}]
};


enUK={
	"MainMenu":[{
		"Start": "Begin",
		"Options": "Settings",
		"Exit": "Leave"
	}]
};

});

Then, in your main.js file make sure you add game.lang.load to your .requires and then in .defines add Lang = enUS. This makes it easy to switch between different languages on the fly. So wherever you render text, in the menu for instance, you can just call Lang.MainMenu[0]["Start"] and have it translate into whatever language you want! Easy peasy!

1 decade ago by fugufish

this works well for english and any language that is based on the the alphabet. Any idea how to integrate this with other languages like chinese? The setup will look different, and drawing the chinese characters isn't supported with the ig.Font tool atm.
Page 1 of 1
« first « previous next › last »