From beeb0d6154d7b42af97d5c3d7655ec6432a35338 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Fri, 15 Sep 2023 18:21:00 +0300 Subject: [PATCH] docs: added docs for multi-language support (#5026) * docs: added docs for multi-language support * fix sidebar * fix sidebar ref * added config step --- www/docs/content/admin/quickstart.mdx | 14 +++++ .../contribution/admin-translations.md | 56 +++++++++++++++++++ .../docs.md} | 7 ++- www/docs/content/user-guide.mdx | 6 ++ www/docs/content/user-guide/users/profile.md | 18 ++++++ www/docs/sidebars.js | 13 ++++- www/docs/vercel.json | 4 ++ 7 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 www/docs/content/contribution/admin-translations.md rename www/docs/content/{contribution-guidelines.md => contribution/docs.md} (99%) diff --git a/www/docs/content/admin/quickstart.mdx b/www/docs/content/admin/quickstart.mdx index d11177b183..4bc9143492 100644 --- a/www/docs/content/admin/quickstart.mdx +++ b/www/docs/content/admin/quickstart.mdx @@ -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 +``` + +Where `` 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. diff --git a/www/docs/content/contribution-guidelines.md b/www/docs/content/contribution/docs.md similarity index 99% rename from www/docs/content/contribution-guidelines.md rename to www/docs/content/contribution/docs.md index 6f86c2cc30..9db892e772 100644 --- a/www/docs/content/contribution-guidelines.md +++ b/www/docs/content/contribution/docs.md @@ -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. diff --git a/www/docs/content/user-guide.mdx b/www/docs/content/user-guide.mdx index 11a77ab7f0..cb2f5c0aa5 100644 --- a/www/docs/content/user-guide.mdx +++ b/www/docs/content/user-guide.mdx @@ -61,6 +61,12 @@ At the top right you’ll find a