Skip to content

Compatibility with Internationalization (i18n) #37

@dealmengor

Description

@dealmengor

Is your feature request related to a problem?

I need to write a documentation in two languages, starlight have by default this support and works great; however the autogenerated routes and pages based on the opeanapi yaml, I wasn't able to create a version in both languages.

Describe the solution you'd like

I would like an easy way to read for example .yaml file in Spanish and another one in English and it make compatible with the Internationalization (i18n) from the Astro starlight template.

Describe alternatives you've considered

I almost find a workaround by my own but wasn't possible.

  1. I created two sub-folders inside schemas folder: ES, EN
  2. Inside the folder add the documentation for example: schemas/en/pad.yaml and schemas/es/pad.yaml
  3. Then in the astro.config.mjs file do something like this:
      plugins: [
          // Generate the OpenAPI documentation pages.
          starlightOpenAPI([
	          {
		          base: 'services-pad',
		          label: 'PAD',
		          schema: 'schemas/en/pad.yaml',
	          },
	          {
		          base: 'services-pad',
		          label: 'PAD',
		          schema: 'schemas/es/pad.yaml',
	          }
          ]),
      ],
  1. And the sidebar array was like this:
      sidebar: [
          {
	          label: '📚 Guías',
	          items: [{ label: 'Introducción', link: '/guides/intro/' }],
          },
          {
	          // Add the generated sidebar group to the sidebar.
	          label: '🛠️ Services',
	          badge: { text: 'New', variant: 'note' },
	          items: [
		          ...openAPISidebarGroups,],
          }
      ],
  1. It work because generated the /es/ routes but in the menu was redundant, I tried to modify but I wasn't able to do it, could be nice a way to avoid this duplicate menu entry, and also this support can work with multiple schemas.
  2. Epic fail result...
    image

Additional Context

Thanks in advance and nice work doing this plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions