Crowdin Localization Progress

node v14.17.6
version: 6.0.0
endpointsharetweet
const request = require("request"); const send = (res, json) => res.end(JSON.stringify(json, null, 2)); exports.endpoint = async function (req, res) { request.get({ "headers": { "Authorization": `Bearer ${process.env.crowdinAccessToken}` }, "url": "https://crowdin.com/api/v2/projects/418358/languages/progress?limit=500" }, (error, response, body) => { if (error) { send(res, { subject: 'translated', status: 'error', color: 'grey' }) } else { let progress = 0; const data = JSON.parse(body).data; for (const lang of data) { progress += lang.data.translationProgress; } send(res, { subject: 'translated', status: `${Math.floor(progress / data.length)}%`, color: 'pink' }) } }); };
Loading…

no comments

    sign in to comment