#Can Astro generates directory for each languages set in locales props ?

2 messages · Page 1 of 1 (latest)

analog mothBOT
#

Hi @modern kite. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

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.

For more information, refer to the Astro documentation on internationalization (https://docs.astro.build/en/guides/internationalization/#configure-i18n-routing).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: