Skip to content

tweak: format yaml like weblate does#343

Merged
Tienisto merged 2 commits intoslang-i18n:mainfrom
adil192:tweak/format-yaml-like-weblate
Jan 19, 2026
Merged

tweak: format yaml like weblate does#343
Tienisto merged 2 commits intoslang-i18n:mainfrom
adil192:tweak/format-yaml-like-weblate

Conversation

@adil192
Copy link
Contributor

@adil192 adil192 commented Jan 19, 2026

Following up on #299 (comment).

I want to integrate Weblate to make submitting translations easier for my contributors, but when using it, Weblate and slang fight over how the yaml files should be formatted, leading to PRs looking like this:
PR with lots of whitespace formatting changes in yaml files


Weblate was also wrapping lines that got too long, but I can probably just disable this in the Weblate settings. I haven't added line wrapping in this PR.
image

@adil192
Copy link
Contributor Author

adil192 commented Jan 19, 2026

Also some other things:

  1. What do you think about adding a command that reformats all yaml files, e.g. dart run slang format?
    This way, any formatting changes from Weblate or other tools can be discarded before merge.

    dart run slang normalize already reformats all yaml files except english / the base locale, so we could alternatively just make slang normalize also format (but not normalize) the english yaml?

  2. I recommend using the leading_newlines_in_multiline_strings linter rule to make these tests and their indentations easier to read, e.g.:

          final expected = '''fruits:
    - apple
    - banana
    - cherry
    ''';

    turns into

          final expected = '''
    fruits:
    - apple
    - banana
    - cherry
    ''';

@Tienisto
Copy link
Member

Thanks! And I agree that slang normalize should also reformat the base translations.

@Tienisto Tienisto merged commit e3ef616 into slang-i18n:main Jan 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants