Skip to content

Commit

Permalink
added localization setup details to versioning page (#440)
Browse files Browse the repository at this point in the history
* added localization setup details to versioning page

* Update settings/versioning.mdx

Co-authored-by: Hahnbee Lee <[email protected]>

* Update settings/versioning.mdx

Co-authored-by: Hahnbee Lee <[email protected]>

* update copy

* add the

---------

Co-authored-by: Brandon Waselnuk <[email protected]>
Co-authored-by: Hahnbee Lee <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent f890bab commit 048eaaa
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 16 deletions.
6 changes: 3 additions & 3 deletions settings/global.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ locale. We currently support localization in English, Chinese, Spanish, French,
Japanese, and Portuguese.

<Info>
Localization applies to the UI and fixed assets in the docs, such as "was this
page helpful".
Localization auto-translates the UI and fixed assets in the docs, such as "Was
this page helpful?". You must translate the content of the pages yourself.
</Info>

For more information, please refer to our
[versioning documentation](/settings/versioning).
[versioning & localization documentation](/settings/versioning).

Example:

Expand Down
70 changes: 57 additions & 13 deletions settings/versioning.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
title: 'Versioning'
description: 'Build separate versions'
icon: 'square-chevron-down'
title: "Versioning & Localization"
description: "Build separate versions or localizations"
icon: "square-chevron-down"
---

Mintlify supports versioning or localization. You can use one or the other, not both.

These guides will assume `v1` pages are in a folder named `v1`, `v2` pages are in a folder named `v2`, and so on. While this method of structuring your files isn't strictly necessary, it's a great way to keep your files organized.

## Setup
## Versioning

### Setup

Add `"versions": ["v2", "v1"]` to your `mint.json` file where `v1` and `v2` are the names of your versions. You can put any number of versions in this array. The first version from the array serves as the default version.

Expand All @@ -26,7 +30,7 @@ If you would like to specify a default version, you can do so like this:
`mint.json`.
</Tip>

## Versioning Groups and Pages
### Versioning Groups and Pages

The best way to specify page versions is by adding a version value to a group in the navigation. When you specify the version of a group, that version is applied to all pages within that group.

Expand All @@ -45,17 +49,20 @@ You can also specify the version of a single page in the page metadata. Versions

```yaml Pages (quickstart.mdx)
---
title: 'Quickstart'
version: 'v2'
title: "Quickstart"
version: "v2"
---
```

</CodeGroup>

<Warning>
While it is possible to nest versioned groups within versioned groups, it is not recommended. If you do take this approach, the more deeply-nested version takes precedence.
While it is possible to nest versioned groups within versioned groups, it is
not recommended. If you do take this approach, the more deeply-nested version
takes precedence.
</Warning>

### Versioning Tabs and Anchors
#### Versioning Tabs and Anchors

You can hide a tab or anchor based on a version. This is useful if you have links that are only relevant in one version. Importantly, this does **not** apply the version to the pages within that anchor.

Expand Down Expand Up @@ -100,17 +107,21 @@ In `mint.json`, simply add `version` to your tab or anchor. Tabs and anchors wit
},
],
```

</CodeGroup>

### Sharing Between Versions
#### Sharing Between Versions

Not _all_ content has to be hidden though! Any content without a specified version appears in every version so you don't have to duplicate content!

<Tip>
When using localization with versioning, each version can have its own set of translations. This means you can have different language versions for different API versions, giving you full flexibility in managing both versioned and localized content.
When using localization with versioning, each version can have its own set of
translations. This means you can have different language versions for
different API versions, giving you full flexibility in managing both versioned
and localized content.
</Tip>

## Troubleshooting
### Troubleshooting

Common errors and how to fix them

Expand All @@ -119,11 +130,44 @@ Common errors and how to fix them
You likely nested a version inside of another. For example, your group had version "v1" but your page had version "v2".

We do not recommend nesting versions inside of each other because it's hard to maintain your docs later.

</Accordion>

<Accordion title="Missing Pages" icon="circle-exclamation">
If you add versions to your docs and the pages disappeared from your
navigation, make sure you spelled the version the same as in your `versions`
array in `mint.json`.
</Accordion>
</AccordionGroup>
</AccordionGroup>

## Localization

### Setup

`"versions"` in your `mint.json` can be leveraged to create different language versions by adding a `locale` value to the version. The first localization from the array serves as the default localization.

We currently support localization in English (`en`), Chinese (`cn`), Spanish (`es`), French (`fr`), Japanese (`jp`), Portuguese (`pt`), and German (`de`).

```json mint.json example
"versions": [
{
"name": "English",
"locale": "en",
},
{
"name": "French",
"locale": "fr",
},
{
"name": "Spanish",
"locale": "es"
}
]
```

<Tip>
The versions dropdown will show your localizations in the order you include
them in the `mint.json`.
</Tip>

Once setup, the rest of localization is handled by the versioning setup described above.

0 comments on commit 048eaaa

Please sign in to comment.