MCPcopy Index your code
hub / github.com/darkreader/darkreader / getLocaleFiles

Function getLocaleFiles

tasks/translate.js:177–199  ·  view source on GitHub ↗

* @returns {Promise }

(locale)

Source from the content-addressed store, hash-verified

175 * @returns {Promise<string[]>}
176 */
177async function getLocaleFiles(locale) {
178 /** @type {string[]} */
179 const results = [];
180
181 /** @type {(dir: string) => Promise<void>} */
182 const walk = async (dir) => {
183 const entries = await fs.readdir(dir);
184 const matched = entries.filter((f) => f === `${locale}.config` || f.endsWith(`.${locale}.config`));
185 results.push(...matched);
186
187 for (const e of entries) {
188 const p = `${dir}/${e}`;
189 const stat = await fs.stat(p);
190 if (stat.isDirectory()) {
191 walk(p);
192 }
193 }
194 };
195
196 await walk(LOCALES_ROOT);
197
198 return results;
199}
200
201/**
202 * @param {string} text

Callers 2

translateEnMessageFunction · 0.85
translateNewEnMessagesFunction · 0.85

Calls 1

walkFunction · 0.70

Tested by

no test coverage detected