MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / loadUpdatedLocales

Function loadUpdatedLocales

scripts/transifex.mjs:217–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215});
216
217async function loadUpdatedLocales() {
218 const diffUrl = process.env.DIFF_URL;
219 if (!diffUrl) return;
220 const res = await fetch(diffUrl);
221 const result = await res.text();
222 // Example:
223 // diff --git a/_locales/ko/messages.yml b/_locales/ko/messages.yml
224 const langs = result.split('\n')
225 .map(line => {
226 const matches = line.match(/^diff --git a\/_locales\/([^/]+)\/messages.yml b\/_locales\/([^/]+)\/messages.yml$/);
227 const [, code1, code2] = matches || [];
228 return code1 === code2 && code1;
229 })
230 .filter(Boolean);
231 return langs;
232}
233
234async function pushTranslations(lang) {
235 const { local, remote } = await loadData(lang);

Callers 1

mainFunction · 0.85

Calls 3

filterMethod · 0.80
mapMethod · 0.80
textMethod · 0.45

Tested by

no test coverage detected