dojo / i18n

:rocket: Dojo 2 - internationalization library.
http://dojo.io
Other
6 stars 19 forks source link

Feature Request: Loading multiple bundles at once #50

Closed sebilasse closed 7 years ago

sebilasse commented 7 years ago

Question :

If I've got some strings (e.g. button labels or header description used everywhere) in /common.ts and some strings (e.g. for the FAQ page) in /faq.ts

Could I i18n() them mixed together at once ?

sebilasse commented 7 years ago

solved by using

function objectPromiseAll(obj: PromiseObject, mapFn?: PromiseFn) {
  const _keys = Object.keys(obj);
  return Promise.all(_keys.map(k => mapFn ? mapFn(obj[k], k) : obj[k]))
    .then(result => result.reduce(toObject(_keys), {}));
};