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

plugin_i18n_default_locale stays 'en', even if STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE is set #19978

Open
dithom opened this issue Apr 1, 2024 · 0 comments
Assignees
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: plugin:i18n Source is plugin/i18n package status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@dithom
Copy link

dithom commented Apr 1, 2024

Bug report

Required System information

  • Node.js version: 20.11.1
  • NPM version: 10.2.4
  • Strapi version: 4.20.5
  • Database: MySQL
  • Operating system: macOS
  • Is your project Javascript or Typescript: Typescript

Describe the bug

When starting Strapi for the first time with an empty database and the env var STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE set to something other, than en, the locale gets created correctly but it won't get set as default in the database. The key plugin_i18n_default_locale stays en. This leads to all content types not being visible in the content manager. However it can be fixed by setting the desired locale as default in the database or using the admin ui.

EDIT: This does not happen only on initial start but on every deployment.

Expected behavior

The locale set using STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE should be set as default in the database.

EDIT: I temporarily fixed the issue using following code:

src/index.ts

export default {
  async bootstrap({ strapi }) {
    // Hotfix for i18n plugin default locale, see: https://github.com/strapi/strapi/issues/19978
    const i18nPluginStore = strapi.store({ type: "plugin", name: "i18n" });
    await i18nPluginStore.set({ key: "default_locale", value: process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE });
  },
};
@joshuaellis joshuaellis added issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve status: pending reproduction Waiting for free time to reproduce the issue, or more information source: plugin:i18n Source is plugin/i18n package labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: plugin:i18n Source is plugin/i18n package status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
Status: To review
Development

No branches or pull requests

3 participants