Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding log when no translation is found in provided local/fallback #154

Closed
ThibaultAndreis opened this issue Oct 13, 2023 · 5 comments
Closed

Comments

@ThibaultAndreis
Copy link

I think it would be useful to have logs specifying which translation is missing.

Currently, if no translation is found, no log specifies if it's missing from the provided locale and/or fallback.

I've made a pull request in sveltekit-i18n/base to propose small changes that would add them.

@Skylli202
Copy link

I think that would be helpful. I've had an unpleasant time recently trying to find which translation were missing.

@jarda-svoboda
Copy link
Member

Hi @ThibaultAndreis! Thanks for your PR! I see it useful too, but I'd vote for debug log level..

@ThibaultAndreis
Copy link
Author

I can change that
Should we then add a warn if no tranlsation nor fallback value is found ?

like so :

if (text === undefined) {
    logger.debug(`No translation provided for '${key}' key in fallback '${fallbackLocale}'.`);
    if (rest.hasOwnProperty('fallbackValue')  ) {
      return rest.fallbackValue;
    }
    logger.warn(`No translation nor fallback found for '${key}' .`);
  }

@ThibaultAndreis
Copy link
Author

i've made the changes to my PR

@jarda-svoboda
Copy link
Member

jarda-svoboda commented Nov 2, 2023

Published 🚀
@sveltekit-i18n/[email protected]

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

No branches or pull requests

3 participants