Skip to content

Commit 79c4c00

Browse files
authored
fix: cli i18n "no changes" log (#1233)
* fix: show no changes when nothing to translate in xcode-xcstrings-v2 * fix: formatting
1 parent 055b53f commit 79c4c00

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

.changeset/clean-turtles-sit.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+
i18n xcode-scstring-v2 log fix
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
2+
"version": "1.10",
23
"locale": {
34
"source": "en",
4-
"targets": ["es", "ja", "ru"]
5+
"targets": [
6+
"es"
7+
]
58
},
6-
"buckets": [
7-
{
8-
"type": "xcode-xcstrings-v2",
9-
"pathPattern": "example.xcstrings"
9+
"buckets": {
10+
"xcode-xcstrings-v2": {
11+
"include": [
12+
"./example.xcstrings"
13+
]
1014
}
11-
]
12-
}
15+
},
16+
"$schema": "https://lingo.dev/schema/i18n.json"
17+
}

packages/cli/src/cli/cmd/i18n.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import createProcessor from "../processor";
3636
import { withExponentialBackoff } from "../utils/exp-backoff";
3737
import trackEvent from "../utils/observability";
3838
import { createDeltaProcessor } from "../utils/delta";
39+
import { isICUPluralObject } from "../loaders/xcode-xcstrings-icu";
3940

4041
export default new Command()
4142
.command("i18n")
@@ -485,7 +486,23 @@ export default new Command()
485486
}
486487

487488
const finalDiffSize = _.chain(finalTargetData)
488-
.omitBy((value, key) => value === targetData[key])
489+
.omitBy((value, key) => {
490+
const targetValue = targetData[key];
491+
492+
// For ICU plural objects, use deep equality (excluding Symbol)
493+
if (
494+
isICUPluralObject(value) &&
495+
isICUPluralObject(targetValue)
496+
) {
497+
return _.isEqual(
498+
{ icu: value.icu, _meta: value._meta },
499+
{ icu: targetValue.icu, _meta: targetValue._meta },
500+
);
501+
}
502+
503+
// Default strict equality for other values
504+
return value === targetValue;
505+
})
489506
.size()
490507
.value();
491508

0 commit comments

Comments
 (0)