How would you include multiple client-side languages with TAPi18n?

Hi,

I need to show words in different languages on the same template. It seem like all i18n packages assume you only need one language. The server side does have access to all, but it does not make sense to ask the server for each word I want to display.

One option I can think of would be to load all the i18n json files from the client, and then just access the right key in those objects. That means loading the data twice: once for TAPi18n and its reactivity, and then loading all languages to be displayed when multiple language words are required.

Did anyone have to deal with something like this before? Any suggestions?

I added this question to StackOverflow.

I found out that you can get translations in any language using TAPi18n.__('asteroid', {lng: lang}), but only if the language files have been preloaded.

How could I wait for several calls to TAPi18n._loadLanguage(lang).done(function() { console.log('loaded!'); }) to complete using Iron-Router’s waitOn, to make sure all languages are loaded before I try to use them in a template?

ps. _loadLanguage is only available in the client side.

A new branch of TAPi18n (maybe in master when you read this) allows you to specify languages on the client side too, no more preloading required :- )