Closed
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
In Docusaurus v2, we used process.env.DOCUSAURUS_CURRENT_LOCALE
in docusaurus.config.js
to switch sidebar paths, navbar links, etc., based on the current locale. After upgrading to Docusaurus v3, the same pattern no longer has any effect: the config file is evaluated only once at build time and never re-evaluates per‐locale.


Reproducible demo
No response
Steps to reproduce
let currentLocal = process.env.DOCUSAURUS_CURRENT_LOCALE;
let sidebarLocal = currentLocal;
if (currentLocal === 'en') {
sidebarLocal = 'en';
} else {
sidebarLocal = 'tr';
}
module.exports = {
i18n: {
defaultLocale: 'tr',
locales: ['tr', 'en'],
},
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'activities',
path: 'projects/activities',
routeBasePath: 'activities',
sidebarPath: require.resolve(`./sidebars/${sidebarLocal}/activitiesSidebar.js`),
},
],
],
themeConfig: {
navbar: {
logo: {
href: `/${currentLocal}`,
},
},
},
};
- Build the site (
yarn build
) and serve. - Switch the locale via the dropdown to English.
- Notice that the sidebar and logo links remain pointing at
/tr/...
.
Expected behavior
- When switching to English,
process.env.DOCUSAURUS_CURRENT_LOCALE
should update so that:sidebarPath
resolves tosidebars/en/...
- Navbar logo
href
becomes/en/
Actual behavior
- The value of
process.env.DOCUSAURUS_CURRENT_LOCALE
is fixed at build time and does not change per‐locale. - All locale‐specific config remains at the default locale.
Your environment
No response
Self-service
- I'd be willing to fix this bug myself.