Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions slang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,8 @@ dart run slang edit <type> <params...>
To keep the order of the keys consistent, you can normalize the translations.
They will follow the same order as the base locale.

As a side effect, this command also reformats the translation file/files.

```sh
dart run slang normalize [--locale=fr-FR]
```
Expand Down
6 changes: 2 additions & 4 deletions slang/lib/src/runner/normalize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'package:slang/src/utils/log.dart' as log;
const _supportedFiles = [FileType.json, FileType.yaml];

/// Normalizes the translation files according to the base locale.
///
/// As a side effect, this command also reformats the translation file/files.
Future<void> runNormalize({
required SlangFileCollection fileCollection,
required List<String> arguments,
Expand Down Expand Up @@ -40,10 +42,6 @@ Future<void> runNormalize({
log.info('Target: all locales');

for (final locale in translationMap.getLocales()) {
if (locale == fileCollection.config.baseLocale) {
continue;
}

await _normalizeLocale(
fileCollection: fileCollection,
locale: locale,
Expand Down