#Can Astro generates directory for each languages set in locales props ?
2 messages · Page 1 of 1 (latest)
Astro does not automatically generate directories for each language set in the locales property of your i18n configuration. You need to manually create a directory for each language you want to support in your project.
For example, if you are supporting English and French, you would create directories like so:
- Directorysrc/
- Directorypages/
- Directoryen/
- about.astro
- index.astro
- Directoryfr/
- about.astro
- index.astro
Your folder names must match the items in locales exactly. Include a localized folder for your defaultLocale only if you configure prefixDefaultLocale: true to show a localized URL path for your default language (e.g. /en/about/).
If you want to avoid duplicating your code for each language, you might consider using a translation library or service to handle the language-specific text in your application.