Localization & User Language

Obtain the preferred language for a user

Deprecated API

Localization preferences will soon no longer be supported. We are leaving the documentation up for reference, but we do not recommend spending time implementing this API for new games. The vast majority of our players are English-speaking.

Localization (User Language)

Kongregate saves player language preferences and can pass their selection in our iframe games. By checking a quick parameter, you can respect their option even if it's different from their browser default! (Note that this feature is currently only supported for games using our iframe embedding option)

It's actually super simple and the data is already in the parameter we're sending to you. Here's an example of a URL we load an iframe game with:

http://kg.tyrantonline.com/canvas/?DO_NOT_SHARE_THIS_LINK=1&
kongregate_username=PLAYER_NAME&
kongregate_user_id=PLAYER_ID_NUMBER&
kongregate_game_auth_token=GAME_AUTH_TOKEN&
kongregate_game_id=GAME_ID&
kongregate_host=http%3A%2F%2Fwww.kongregate.com&
kongregate_game_url=http%3A%2F%2Fwww.kongregate.com%2Fgames%2Fsynapse%2Ftyrant&
kongregate_api_host=http%3A%2F%2Fapi.kongregate.com&
kongregate_channel_id=CHANNEL_ID&
kongregate_api_path=http%3A%2F%2Fchat.kongregate.com%2Fflash%2FAPI_AS3_efeff9e3f4f6350255b95aa31ba0ef32.swf&
kongregate_ansible_path=chat.kongregate.com%2Fflash%2Fansible_5cae4aad0aa719bffe641383dd1d3178.swf&
kongregate_preview=false&
kongregate_language=en&
preview=false&
kongregate_split_treatments=none&
kongregate=true&KEEP_THIS_DATA_PRIVATE=1

You'll notice near the end of all that is: kongregate_language=en. This identifies this player as having selected "English" as their preferred language. Currently Kongregate also supports German (de) and French (fr). These will adhere to ISO 639-1 standards as we add more languages.

If the Javascript API has been initialized, you can access the language like so:

kongregateAPI.flashVarsObject().kongregate_language

For iframe games which do not use the JavaScript API, you can simply grab the parameter off the URL manually.