/**
* Fetches all translations available and parses them into one big
* object with locales as keys and gettext-parser PO JSON as values.
*/
export const fetchTranslations = (options, credentials = {}) => {
const { project } = options;
feedback.step('Fetching available languages from POEditor...');
return fetchLanguages({ project }, credentials)
.then(languages => {
feedback.step(`Fetching translations for languages: ${languages} ...`);
return languages;
})
.then(languages => Promise.all(
languages.map(language =>
fetchTranslationsForLang({ project, language }, credentials)
)
))
.then(translations => translations.reduce((aggr, poJson) => ({
...aggr,
[poJson.headers.language]: poJson,
}), {}))
.catch(err => feedback.kill(err));
};
I found that the translations from different locales are merged into a json file. it will generate a huge file if i have many languages. It also makes coding splitting difficult.
So, could you tell me Why you do this?
Hi! I'm curious about the code below
I found that the translations from different locales are merged into a json file. it will generate a huge file if i have many languages. It also makes coding splitting difficult. So, could you tell me Why you do this?