docs: added docs for multi-language support (#5026)

* docs: added docs for multi-language support

* fix sidebar

* fix sidebar ref

* added config step
This commit is contained in:
Shahed Nasser
2023-09-15 18:21:00 +03:00
committed by GitHub
parent 5bd7311393
commit beeb0d6154
7 changed files with 115 additions and 3 deletions

View File

@@ -163,6 +163,20 @@ You can learn more about the admin dashboard and its features in the [User Guide
---
## Multi-Language Support
Medusa supports multiple languages and translations.
Refer to this user guide to learn how to switch the language of the Medusa admin.
:::note
Can't find your language? Learn how you can contribute by translating the admin to other languages [here](../contribution/admin-translations.md).
:::
---
## Troubleshooting Installation
<Troubleshooting

View File

@@ -0,0 +1,56 @@
---
sidebar_label: "Admin Translation"
sidebar_position: 2
---
# Contribute by Translating Admin
In this document, you'll learn how you can contribute to Medusa by translating the Medusa admin.
## Overview
The Medusa admin supports multiple languages, with the default being English. To ensure a wide support for different languages, your contribution by translating to other languages you're fluent in is highly appreciated.
This type of contribution is a no-code contribution, meaning you don't need advanced technical skills to contribute.
---
## How to Contribute Translation
1\. Clone the [Medusa monorepository](https://github.com/medusajs/medusa) to your local machine:
```bash
git clone https://github.com/medusajs/medusa.git
```
If you already have it cloned, make sure to pull the latest changes from the `develop` branch.
2\. Create a branch that will be used to open the pull request later:
```bash
git check -b feat/translate-<LANGUAGE>
```
Where `<LANGUAGE>` is your language name. For example, `feat/translate-da`.
3\. Create a new directory under `packages/admin-ui/ui/public/locales` with its name being the [ISO 2 character code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of your language. For example, `da`. In the new directory, create the file `translation.json`.
4\. Copy the content of the English translation file located at `packages/admin-ui/ui/public/locales/en/translation.json` and paste it in your new `translation.json` file.
5\. In the file, leave the key names as-is, and only translate the values.
6\. Next, you need to add the new language into the multi-language configurations. To do that, go to the file `packages/admin-ui/ui/src/i18n/index.ts`.
7\. In `packages/admin-ui/ui/src/i18n/index.ts`, add the new language to the `supportedLanguages` array as an object. The object accepts two properties: `locale` for the ISO 2 character code, and `name` for the name of the language. The name of the language should be the translated name, not the English name. For example:
```ts title=packages/admin-ui/ui/src/i18n/index.ts
export const supportedLanguages = [
// other languages...
{
locale: "da",
name: "Dansk",
},
]
```
8\. Once you're done, push the changes into your branch and open a pull request on GitHub.

View File

@@ -1,4 +1,9 @@
# Contribution Guidelines
---
sidebar_label: "Docs"
sidebar_position: 1
---
# Docs Contribution Guidelines
Thank you for your interest in contributing to the documentation! You will be helping the open source community and other developers interested in learning more about Medusa and using it.

View File

@@ -61,6 +61,12 @@ At the top right youll find a <UiIcon lightIcon="https://res.cloudinary.com/d
![Notifications Window](https://res.cloudinary.com/dza7lstvk/image/upload/v1667924034/Medusa%20Docs/User%20Guide/cTIu9yP_ubsbqx.png)
### Change Language
The Medusa admin supports multiple-languages, with English being the default one.
Learn how to change the language in [this guide](./user-guide/users/profile.md#change-admin-language).
### Quick Actions
At the top left in the sidebar, youll find an avatar icon. By clicking this icon, youll see a dropdown. You can use this dropdown to access settings or sign out.

View File

@@ -36,6 +36,24 @@ To edit your profile details:
---
## Change Admin Language
The Medusa admin supports multiple languages, and you can change the default language from your profile settings.
To change the language:
1. Go to Settings → Personal Information.
2. For the Language field, select the language you want from the dropdown.
3. The language will be saved and changed.
:::tip
Can't find your language? Learn how you can contribute by translating the admin to other languages [here](../../contribution/admin-translations.md).
:::
---
## Edit Analytics Preferences
To edit your analytics collection preferences:

View File

@@ -440,13 +440,22 @@ module.exports = {
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "contribution-guidelines",
type: "category",
link: {
type: "doc",
id: "contribution/docs",
},
label: "Contribution Guidelines",
customProps: {
sidebar_icon: "document-text",
},
className: "homepage-sidebar-item",
items: [
{
type: "autogenerated",
dirName: "contribution",
},
],
},
{
type: "doc",

View File

@@ -476,6 +476,10 @@
{
"source": "/recipes/rbac",
"destination": "/modules/users/backend/rbac"
},
{
"source": "/contribution-guidelines",
"destination": "/contribution/docs"
}
]
}