Skip to content

Provide verification functions #66

@cromefire

Description

@cromefire

It would be great id you could provide a function that can check whether the translation files are complete (and maybe also sorted correctly if --sort is enabled).

The intended usage where I think this can help is in the CI to check whether everything was translated. Alternatively you can just execute a merge in the CI and try to check, whether git thinks they changed, but that would probably be a pretty annoying and wasteful thing to do (and easy to misconfigure).

With that function I'd expect something like:

ngx-translate-extract --format-indentation '  ' --sort --input ./src/app --output ./public/i18n/{en,de}.json --null-as-default-value --check --format namespaced-json

And it'd say something like this:

All translations present

or

Error: Key "some.random.key" is missing from file "public/i18n/en.json"

or

Error: Key "some.random.key" from file "public/i18n/en.json" is not used

or

Error: Key "some.random.key" in file "public/i18n/en.json" is null

or

Error: Keys in file "public/i18n/en.json" are not sorted

(And exit with a non-zero exit status in the error cases)

I think that'd help people to not forget to translate something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions