Skip to content

Commit e541a12

Browse files
authored
fix(cli): inject locale (#612)
1 parent 3c7db4c commit e541a12

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/fair-elephants-prove.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
inject locale

packages/cli/src/cli/loaders/inject-locale.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ export default function createInjectLocaleLoader(
2020
if (!injectLocaleKeys) {
2121
return data;
2222
}
23+
24+
// ensures locale keys are in correct position
25+
const mergedData = _.merge({}, originalInput, data);
26+
2327
injectLocaleKeys.forEach((key) => {
24-
if (_.get(originalInput, key) === originalLocale) {
25-
_.set(data, key, locale);
28+
if (_.get(mergedData, key) === originalLocale) {
29+
_.set(mergedData, key, locale);
2630
}
2731
});
28-
return data;
32+
33+
return mergedData;
2934
},
3035
});
3136
}

0 commit comments

Comments
 (0)