rohit-gohri / redocusaurus

OpenAPI for Docusaurus with Redoc
https://redocusaurus.vercel.app/
MIT License
642 stars 115 forks source link

Support for i18n #284

Open lightmagic1 opened 1 year ago

lightmagic1 commented 1 year ago

Can i somehow make my API specification available in multi-language setup?

rohit-gohri commented 1 year ago

I'm not sure how that would look like, do you have any examples on what the feature would look like for a user?

I think we could add support for i18n that could work like how it does for blogs where you would have 1 OpenAPI file for each language, WDYT? That would leave managing of the translations upto the developer of the site.

Logerfo commented 1 year ago

A cool feature would be to have text attributes as i18n objects. For example, instead of:

description: This is a nice description

We could have:

description:
  en: This is a nice description
  pt-BR: Essa é uma descrição legal

But I understand that requires more work to achieve.

I would be happy with the possibility to have multiple YAML files, like:

docs/
|-openapi.yaml
|-openapi-pt-BR.yaml

And make the plugin generate the correct i18n file structure for docusaurus:

website
|-docs/
  |-openapi.html
|-i18n/
  |-pt-BR/
    |-docusaurus-plugin-content-docs/
      |-current/
        |-openapi.html
Nostromos commented 9 months ago

@Logerfo check out jsdoc-to-mdx! They have an interesting way of dealing with i18n that you may be able to crib from for use with redocusaurus.

bryanjtc commented 8 months ago

Any alternative available while redocusaurus works on adding i18n support?

rohit-gohri commented 8 months ago

@bryanjtc None I'm aware about. But thanks for reviving this (also @Nostromos ).

I started looking into it, and docusaurus has pretty extensive translation workflows that I'd like to plug into - https://docusaurus.io/docs/api/plugin-methods/i18n-lifecycles rather than having it manage as multiple yaml files

It would help a lot if someone can share any public docusaurus projects that use i18n, especially for anything other than markdown, so that I can use them as reference.

rohit-gohri commented 8 months ago

I think this is the current best work-around - https://github.com/rohit-gohri/redocusaurus/discussions/317#discussioncomment-7563902