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

Function stringifyLocale

tasks/translate.js:136–153  ·  view source on GitHub ↗

* @param {Map } messages * @returns {string}

(messages)

Source from the content-addressed store, hash-verified

134 * @returns {string}
135 */
136function stringifyLocale(messages) {
137 /** @type {string[]} */
138 const lines = [];
139 messages.forEach((message, id) => {
140 lines.push(`@${id}`);
141 const hasDoubleNewLines = /\n\n/.test(message);
142 message.split('\n')
143 .filter((line) => line.trim())
144 .forEach((line, index, filtered) => {
145 lines.push(line);
146 if (hasDoubleNewLines && index < filtered.length - 1) {
147 lines.push('');
148 }
149 });
150 lines.push('');
151 });
152 return lines.join('\n');
153}
154
155/**
156 * @returns {Promise<string[]>}

Callers 2

translateEnMessageFunction · 0.85
translateNewEnMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected