opral / inlang-sdk

0 stars 0 forks source link

add logs to `plugin.import & export` #213

Open samuelstroschein opened 1 month ago

samuelstroschein commented 1 month ago

Context

Building plugins incrementally is easier if a plugin can emit warnings. Emitting warnings allows starting with a subset of a format that used by the majority of users before adding every feature of a format.

For example, i18next allows referencing other keys. Cool feature. But not supported in the inlang SDK and likely used by a tiny minority in the i18next community. Ignoring the message and emitting a warning "referencing

  "keyNesting": "reuse $t(keyDeep.inner)",

Proposal

Add an API to emit warnings.

samuelstroschein commented 1 month ago

After sync call with @niklas.buchfink the api is rly benefitial.


    files[0].logs = [
        level: "warning",
        bundleId: "keyContext"
        message: "This is a warning",
    ]
samuelstroschein commented 1 month ago

Agreed with @niklas.buchfink that warnings out of scope.