Skip to content

Commit 0dda719

Browse files
authored
feat(cat-voices): sort translations when melos l10n is run (#3771)
* feat: sort translations when melos l10n is run * chore: cleanup l10n-check and l10n-clean * fix: manage l10n should work with ci paths
1 parent e626a76 commit 0dda719

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

catalyst_voices/packages/internal/catalyst_voices_localization/lib/src/manage_l10n.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ void main(List<String> args) {
2525
).process();
2626
}
2727

28+
const _ciRootDir = '/frontend';
29+
const _localRootDir = '/catalyst_voices';
30+
2831
class ArbManager {
2932
final bool clean;
3033
final bool sort;
@@ -149,12 +152,12 @@ class ArbManager {
149152
Directory _findRootDir() {
150153
var current = Directory.current;
151154
while (current.path != current.parent.path) {
152-
if (current.path.endsWith('catalyst_voices')) {
155+
if (current.path.endsWith(_localRootDir) || current.path.endsWith(_ciRootDir)) {
153156
return current;
154157
}
155158
current = current.parent;
156159
}
157-
throw Exception('Could not find catalyst_voices directory');
160+
throw Exception('Could not find root directory, searched for [$_localRootDir, $_ciRootDir]');
158161
}
159162

160163
List<File> _getAllDartFiles(Directory dir) {

catalyst_voices/pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,20 @@ melos:
7373
7474
l10n:
7575
run: |
76+
melos exec --scope="catalyst_voices_localization" -- dart lib/src/manage_l10n.dart --sort && \
7677
melos exec --scope="catalyst_voices_localization" -- flutter gen-l10n
7778
description: |
7879
Run `flutter gen-l10n` in catalyst_voices_localization package to generate l10n bindings.
7980
8081
l10n-check:
8182
run: |
82-
cd packages/internal/catalyst_voices_localization && dart lib/src/manage_l10n.dart --check
83+
melos exec --scope="catalyst_voices_localization" -- dart lib/src/manage_l10n.dart --check
8384
description: |
8485
Check for unused translation keys in .arb files without modifying them, and check if translation keys are sorted.
8586
8687
l10n-clean:
8788
run: |
88-
cd packages/internal/catalyst_voices_localization && dart lib/src/manage_l10n.dart --clean --sort
89+
melos exec --scope="catalyst_voices_localization" -- dart lib/src/manage_l10n.dart --clean --sort
8990
description: |
9091
Clean up unused translation keys and sort them alphabetically in .arb files.
9192

0 commit comments

Comments
 (0)