(locale, messagesDir)
| 99 | } |
| 100 | |
| 101 | function loadSplitSettings(locale, messagesDir) { |
| 102 | const settingsDir = path.join(getMessagesDir(messagesDir), locale, "settings"); |
| 103 | if (!fs.existsSync(settingsDir)) return null; |
| 104 | |
| 105 | const top = {}; |
| 106 | for (const file of fs.readdirSync(settingsDir, { withFileTypes: true })) { |
| 107 | if (file.isDirectory()) continue; |
| 108 | if (!file.name.endsWith(".json")) continue; |
| 109 | const name = file.name.replace(/\.json$/, ""); |
| 110 | const v = loadJSON(path.join(settingsDir, file.name)); |
| 111 | if (name === "strings") Object.assign(top, v); |
| 112 | else top[name] = v; |
| 113 | } |
| 114 | |
| 115 | const providersDir = path.join(settingsDir, "providers"); |
| 116 | const providers = {}; |
| 117 | if (fs.existsSync(providersDir)) { |
| 118 | for (const file of fs.readdirSync(providersDir, { withFileTypes: true })) { |
| 119 | if (file.isDirectory()) continue; |
| 120 | if (!file.name.endsWith(".json")) continue; |
| 121 | const name = file.name.replace(/\.json$/, ""); |
| 122 | const v = loadJSON(path.join(providersDir, file.name)); |
| 123 | if (name === "strings") Object.assign(providers, v); |
| 124 | else providers[name] = v; |
| 125 | } |
| 126 | |
| 127 | const formDir = path.join(providersDir, "form"); |
| 128 | const form = {}; |
| 129 | if (fs.existsSync(formDir)) { |
| 130 | for (const file of fs.readdirSync(formDir, { withFileTypes: true })) { |
| 131 | if (file.isDirectory()) continue; |
| 132 | if (!file.name.endsWith(".json")) continue; |
| 133 | const name = file.name.replace(/\.json$/, ""); |
| 134 | const v = loadJSON(path.join(formDir, file.name)); |
| 135 | if (name === "strings") Object.assign(form, v); |
| 136 | else form[name] = v; |
| 137 | } |
| 138 | } |
| 139 | providers.form = form; |
| 140 | } |
| 141 | |
| 142 | top.providers = providers; |
| 143 | return top; |
| 144 | } |
| 145 | |
| 146 | function saveSplitSettingsFromCanonical(locale, merged, messagesDir) { |
| 147 | const root = getMessagesDir(messagesDir); |
no test coverage detected