MCPcopy Create free account
hub / github.com/bytebase/bytebase / mergeMessages

Function mergeMessages

frontend/scripts/check-react-i18n.mjs:135–153  ·  view source on GitHub ↗
(base, override)

Source from the content-addressed store, hash-verified

133}
134
135function mergeMessages(base, override) {
136 const result = { ...base };
137 for (const [key, value] of Object.entries(override)) {
138 const existing = result[key];
139 if (
140 existing &&
141 typeof existing === "object" &&
142 !Array.isArray(existing) &&
143 value &&
144 typeof value === "object" &&
145 !Array.isArray(value)
146 ) {
147 result[key] = mergeMessages(existing, value);
148 } else {
149 result[key] = value;
150 }
151 }
152 return result;
153}
154
155// i18next pluralization: _one/_other suffixes map to the base key in code
156function baseKey(key) {

Callers 1

loadLocaleKeysFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected