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

Disable 'missing translation key' for default locale when using text as keys #164

Open
paulathevalley opened this issue May 31, 2023 · 0 comments · May be fixed by #165
Open

Disable 'missing translation key' for default locale when using text as keys #164

paulathevalley opened this issue May 31, 2023 · 0 comments · May be fixed by #165

Comments

@paulathevalley
Copy link

paulathevalley commented May 31, 2023

Is your feature request related to a problem? Please describe.

When using text as keys for the default locale, this particular log to the console becomes very noisy:
https://github.com/yassinedoghri/astro-i18next/blob/beta/src/utils.ts#L59-L62

// astro-i18next.config.ts
import type { AstroI18nextConfig } from "astro-i18next";

const config: AstroI18nextConfig = {
  defaultLocale: "en",
  locales: ["en", "es"],
  i18nextServer: {
    debug: true,
    // Set key as fallback https://www.i18next.com/principles/fallback#key-fallback
    fallbackLng: false,
    backend: {
      loadPath: "./public/locales/{{lng}}/{{ns}}.json",
      addPath: "./public/locales/{{lng}}/{{ns}}.missing.json",
    },
    saveMissing: true
  },
};

export default config;

public/locales/en/translation.json

{ 
  "Hello": "Hello",
  "Search": "Search"
}

public/locales/es/translation.json

{
  "Hello": "Hola",
  "Search": "Buscar"
}

console:

WARNING(astro-i18next): missing translation key Hello
WARNING(astro-i18next): missing translation key Search

Describe the solution you'd like

Is it possible to disable the WARNING(astro-i18next): missing translation key logging for the default locale?

Describe alternatives you've considered

Related issues:
i18next/i18next#1634 (comment)
i18next/react-i18next#1534

Is it possible to use this approach (using text as keys for default locale) without a noisy console?

thank you for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant