From 29d3640546764fcf0852a54a4c72cf5aeb54247e Mon Sep 17 00:00:00 2001 From: Fuegovic <32828263+fuegovic@users.noreply.github.com> Date: Sat, 26 Aug 2023 19:36:25 -0400 Subject: [PATCH] docs: updates (#841) --- .env.example | 10 +- README.md | 3 +- docs/contributions/language-contributions.md | 80 ------------- .../contributions/translation_contribution.md | 113 ++++++++++++++++++ docs/general_info/breaking_changes.md | 6 +- docs/install/container_install.md | 2 +- docs/install/default_language.md | 36 ++++++ docs/install/languages.md | 113 ------------------ mkdocs.yml | 3 +- 9 files changed, 162 insertions(+), 204 deletions(-) delete mode 100644 docs/contributions/language-contributions.md create mode 100644 docs/contributions/translation_contribution.md create mode 100644 docs/install/default_language.md delete mode 100644 docs/install/languages.md diff --git a/.env.example b/.env.example index 64c73b769..79b712ccb 100644 --- a/.env.example +++ b/.env.example @@ -27,7 +27,7 @@ MONGO_URI=mongodb://127.0.0.1:27018/LibreChat # Access key from OpenAI platform. # Leave it blank to disable this feature. # Set to "user_provided" to allow the user to provide their API key from the UI. -OPENAI_API_KEY="user_provided" +OPENAI_API_KEY=user_provided # Identify the available models, separated by commas *without spaces*. # The first will be default. @@ -77,7 +77,7 @@ AZURE_OPENAI_MODELS=gpt-3.5-turbo,gpt-4 #If this fails, follow these instructions https://github.com/danny-avila/LibreChat/issues/370#issuecomment-1560382302 to provide the full cookie strings. # Set to "user_provided" to allow the user to provide its token from the UI. # Leave it blank to disable this endpoint. -BINGAI_TOKEN="user_provided" +BINGAI_TOKEN=user_provided # BingAI Host: # Necessary for some people in different countries, e.g. China (https://cn.bing.com) @@ -93,7 +93,7 @@ BINGAI_TOKEN="user_provided" # Exposes your access token to `CHATGPT_REVERSE_PROXY` # Set to "user_provided" to allow the user to provide its token from the UI. # Leave it blank to disable this endpoint -CHATGPT_TOKEN="user_provided" +CHATGPT_TOKEN=user_provided # Identify the available models, separated by commas. The first will be default. # Leave it blank to use internal settings. @@ -114,7 +114,7 @@ CHATGPT_MODELS=text-davinci-002-render-sha,gpt-4 # Leave it blank to disable this feature. # Set to "user_provided" to allow the user to provide their API key from the UI. # Note that access to claude-1 may potentially become unavailable with the release of claude-2. -ANTHROPIC_API_KEY="user_provided" +ANTHROPIC_API_KEY=user_provided ANTHROPIC_MODELS=claude-1,claude-instant-1,claude-2 ############################# @@ -166,7 +166,7 @@ AZURE_COGNITIVE_SEARCH_SEARCH_OPTION_SELECT= # Follow the instruction here to setup: # https://github.com/danny-avila/LibreChat/blob/main/docs/install/apis_and_tokens.md -PALM_KEY="user_provided" +PALM_KEY=user_provided # In case you need a reverse proxy for this endpoint: # GOOGLE_REVERSE_PROXY= diff --git a/README.md b/README.md index 7ae144ac8..3af746267 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Keep up with the latest updates by visiting the releases page - [Releases](https * [APIs and Tokens](docs/install/apis_and_tokens.md) * [User Auth System](docs/install/user_auth_system.md) * [Online MongoDB Database](docs/install/mongodb.md) - * [Languages](docs/install/languages.md) + * [Default Language](docs/install/default_language.md)
@@ -116,6 +116,7 @@ Keep up with the latest updates by visiting the releases page - [Releases](https * [Contributor Guidelines](CONTRIBUTING.md) * [Documentation Guidelines](docs/contributions/documentation_guidelines.md) + * [Contribute a Translation](docs/contributions/translation_contribution.md) * [Code Standards and Conventions](docs/contributions/coding_conventions.md) * [Testing](docs/contributions/testing.md) * [Security](SECURITY.md) diff --git a/docs/contributions/language-contributions.md b/docs/contributions/language-contributions.md deleted file mode 100644 index cc8c84a6b..000000000 --- a/docs/contributions/language-contributions.md +++ /dev/null @@ -1,80 +0,0 @@ -# How to add a language to LibreChat - -## Minimum Requirements: - -1. Good knowledge of the language (some terms may undergo significant changes during translation) -2. An editor, which can be Notepad or (**recommended**: [VSCode](https://code.visualstudio.com/download)) - -## Language translation - - -1. Fork the LibreChat repository and download it using git clone https://github.com/danny-avila/LibreChat -2. Navigate to the "client\src\localization" folder and open the "Translation.tsx" file -3. At the beginning of the code, add your language below all the others in this format: - -`import Language-name from './languages/** ';` - -For example, let's take English as an example: - -Note: Replace "LanguageName" with the name of your language (capitalized) and "**" with the ISO 3166 Alpha-2 code of your country (the initial of the nation). -If you don't know the ISO 3166 code for your language, check it [here](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) and also use it with an initial capital) - -4. Further down in the code, add the following - -`if (langCode === '**') return Language-name;` - -Replace "**" with the ISO 3166 Alpha-2 code of your language (in lowercase). Here's an example: `if (langCode === 'en') return English;`) - -7.Go into the "languages" folder and create a file named as follows: **.tsx - -For example: En.tsx - -9. Copy all the content from En.tsx into your file and modify it as follows: - -``` -// your-language-name phrases - -export default { - com_ui_examples: 'Examples', - // Add more translations here -``` - -Rename only the part after the colon ":" to the corresponding translation in your language. For example: - -``` -// my-language phrases - -export default { - com_ui_examples: 'WORD_THAT_I_TRANSLATE_IN_TO_MY_LANGUAGE', - // Add more translations here -}; -``` - -⚠️DO NOT CHANGE com_... ⚠️ - -10. To add your language to the menu, open the file "client\src\components\Nav\SettingsTabs\General.tsx" and add your language to the "LangSelector" variable in the following way: - -``` -export const LangSelector = ({ - //other code - - //other languages... - - - - ); -}; -``` - -where ** is the ISO 3166 Alpha-2 code and "com_nav_lang_your-language-name" stands for the name in your language (for example com_nav_lang_english or com_nav_lang_italian) -The only line of code to add is: - -`` - -11. Commit your changes using git add *, git commit -m "Language translation: your-language translation" and git push. -12. Open your repository in a browser and click on "Contribute" - -![image](https://github.com/Berry-13/LibreChat/assets/81851188/ab91cf4b-1830-4419-9d0c-68fcb2fd5f5e) - -14. Answer all the questions, and in the "Type of Change" section, add `- [x] Translation support` -15. Create a pull request 🎉 diff --git a/docs/contributions/translation_contribution.md b/docs/contributions/translation_contribution.md new file mode 100644 index 000000000..315a43e96 --- /dev/null +++ b/docs/contributions/translation_contribution.md @@ -0,0 +1,113 @@ +# How to add a new language to LibreChat 🌍 + +## Minimum Requirements: + +1. Good knowledge of the language (some terms may undergo significant changes during translation) +2. A text editor is required. While options like Notepad or Notepad++ are available, it is recommended to use **[VSCode](https://code.visualstudio.com/download)** as it is more suitable for this task.. + +## Language Translation + +### Preparation +Fork the [LibreChat repository](https://github.com/danny-avila/LibreChat) and download it using git clone + +### Add your language to `Translation.tsx`: +- Navigate to the `client\src\localization` folder and open the `Translation.tsx` file + +- At the beginning of the code, add your language below all the others in this format: + + `import Language-name from './languages/** ';` + Example (English):`import English from './languages/Eng';` + +- Further down in the code, add the following: + + `if (langCode === '**') return Language-name;` + +>Replace "**" with the ISO 3166 Alpha-2 code of your language (in lowercase). +Example (English): `if (langCode === 'en') return English;` + +>If you don't know the ISO 3166 code for your language, check it [here](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) and also use it with an initial capital) + +### Create your new language file +- Go into the `client\src\localization\languages` folder and create a file named as follows: `**.tsx` + + Example: `Eng.tsx` + +- Copy all the content from `Eng.tsx` into your file and modify it as follows: + + ```js + // your-language-name phrases + + export default { + com_ui_examples: 'Examples', + // more translations here... + ``` + + __Translate only the part after the `:`.__ + Example: + + ```js + // my-language phrases + + export default { + com_ui_examples: 'This is a translated example', + // Add more translations here + }; + ``` + + ⚠️ Do not modify the `com_...` part ⚠️ + +> Delete the Language list after `com_nav_setting_general: 'General',` near the bottom of the file (You do not need to translate the individual language names) + + +### Add your language to `Eng.tsx` +Open `Eng.tsx` and add your language to the language list in the bottom of the document. + +### Add your language to the menu +To add your language to the menu, open the file `client\src\components\Nav\SettingsTabs\General.tsx`. +Add your language to the `LangSelector` variable in the following way: + +```js +export const LangSelector = ({ + //other code + + //other languages... + + + + ); +}; +``` + +Where `**` is the ISO 3166 Alpha-2 code and `com_nav_lang_your-language-name` stands for the name of your language. +Example: `com_nav_lang_english` or `com_nav_lang_italian` + +**You should only need to add one line of code:** +```js + +``` + +### Summary +If you followed everything you should have __one__ new file and __3__ files with modifications: + +```bash + new file: client/src/localization/languages/**.tsx <-----new language + modified: client/src/components/Nav/SettingsTabs/General.tsx + modified: client/src/localization/Translation.tsx + modified: client/src/localization/languages/Eng.tsx +``` + +You can confirm this by using the following command: `git status` + +### Commit and create a new PR +- Commit your changes using: + - `git add *` + - `git commit -m "Language translation: your-language translation"` + - `git push` + +- Open your repository in a browser and click on "Contribute" + +![image](https://github.com/Berry-13/LibreChat/assets/81851188/ab91cf4b-1830-4419-9d0c-68fcb2fd5f5e) + +- Answer all the questions, and in the "Type of Change" section, add `- [x] Translation support` +- Delete irrelevant comments from the template +- Create a pull request 🎉 \ No newline at end of file diff --git a/docs/general_info/breaking_changes.md b/docs/general_info/breaking_changes.md index c76eab171..fc5cac667 100644 --- a/docs/general_info/breaking_changes.md +++ b/docs/general_info/breaking_changes.md @@ -1,9 +1,9 @@ # ⚠️ **Breaking Changes** ⚠️ -## v0.5.8 -**If you have issues after updating, please try to clear your browser cache and cookies!** +## Note: +**If you experience any issues after updating, we recommend clearing your browser cache and cookies.** -Some of the latest changes affect the cookies and can cause weird behaviors if not properly cleared. +Certain changes in the updates may impact cookies, leading to unexpected behaviors if not cleared properly. ## v0.5.7 diff --git a/docs/install/container_install.md b/docs/install/container_install.md index c08b03307..79139c715 100644 --- a/docs/install/container_install.md +++ b/docs/install/container_install.md @@ -31,7 +31,7 @@ podman build \ --file ./LibreChat/Dockerfile; ``` -> Not the downside of running a base container that has a live root is that image revisions need to be done manually. The easiest way is to remove and recreate the image when the container is no longer. If that's not possible for you, manually updating the image to increment versions can be done manually. Simply amend $image with the version you're building. +> Note: the downside of running a base container that has a live root is that image revisions need to be done manually. The easiest way is to remove and recreate the image when the container is no longer. If that's not possible for you, manually updating the image to increment versions can be done manually. Simply amend $image with the version you're building. > We'll document how to go about the update process more effectively further on. You wont need to remove your existing containers, or lose any data when updating. diff --git a/docs/install/default_language.md b/docs/install/default_language.md new file mode 100644 index 000000000..b3dc5c64b --- /dev/null +++ b/docs/install/default_language.md @@ -0,0 +1,36 @@ +# Default Language 🌍 + +## How to change the default language + +- Open this file `client\src\store\language.js` +- Modify the "default" in the lang variable with your ISO 3166 Alpha-2 code : + +Example: +from **English** as default + +```js +import { atom } from 'recoil'; + +const lang = atom({ + key: 'lang', + default: 'en', +}); + +export default { lang }; +``` + +to **Italian** as default + +```js +import { atom } from 'recoil'; + +const lang = atom({ + key: 'lang', + default: 'it', +}); + +export default { lang }; +``` +--- + +### **If you wish to contribute your own translation to LibreChat, please refer to this document for instructions: [Contribute a Translation](../contributions/translation_contribution.md)** diff --git a/docs/install/languages.md b/docs/install/languages.md deleted file mode 100644 index d3d074464..000000000 --- a/docs/install/languages.md +++ /dev/null @@ -1,113 +0,0 @@ -# Languages 🌍 - -## Default language - -1. Open this file "client\src\store\language.js" -2. modify the "default" in the lang variable with your ISO 3166 Alpha-2 code : - -for example from english as default - -``` -import { atom } from 'recoil'; - -const lang = atom({ - key: 'lang', - default: 'en', -}); - -export default { lang }; -``` - -to italian as dafult - -``` -import { atom } from 'recoil'; - -const lang = atom({ - key: 'lang', - default: 'it', -}); - -export default { lang }; -``` - -# How to add a translation to LibreChat - -### Minimum Requirements: - -1. Good knowledge of the language (some terms may undergo significant changes during translation) -2. An editor, which can be Notepad or (**recommended**: [VSCode](https://code.visualstudio.com/download)) - -### Language translation - - -1. Fork the LibreChat repository and download it using git clone https://github.com/danny-avila/LibreChat -2. Navigate to the "client\src\localization" folder and open the "Translation.tsx" file -3. At the beginning of the code, add your language below all the others in this format: - -`import Language-name from './languages/** ';` - -For example, let's take English as an example: - -Note: Replace "LanguageName" with the name of your language (capitalized) and "**" with the ISO 3166 Alpha-2 code of your country (the initial of the nation). -If you don't know the ISO 3166 code for your language, check it [here](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) and also use it with an initial capital) - -4. Further down in the code, add the following - -`if (langCode === '**') return Language-name;` - -Replace "**" with the ISO 3166 Alpha-2 code of your language (in lowercase). Here's an example: `if (langCode === 'en') return English;`) - -7. Go into the "languages" folder and create a file named as follows: **.tsx - -For example: En.tsx - -9. Copy all the content from En.tsx into your file and modify it as follows: - -``` -// your-language-name phrases - -export default { - com_ui_examples: 'Examples', - // Add more translations here -``` - -Rename only the part after the colon ":" to the corresponding translation in your language. For example: - -``` -// my-language phrases - -export default { - com_ui_examples: 'WORD_THAT_I_TRANSLATE_IN_TO_MY_LANGUAGE', - // Add more translations here -}; -``` - -⚠️DO NOT CHANGE com_... ⚠️ - -10. To add your language to the menu, open the file "client\src\components\Nav\SettingsTabs\General.tsx" and add your language to the "LangSelector" variable in the following way: - -``` -export const LangSelector = ({ - //other code - - //other languages... - - - - ); -}; -``` - -where ** is the ISO 3166 Alpha-2 code and "com_nav_lang_your-language-name" stands for the name in your language (for example com_nav_lang_english or com_nav_lang_italian) -The only line of code to add is: - -`` - -11. Commit your changes using git add *, git commit -m "Language translation: your-language translation" and git push. -12. Open your repository in a browser and click on "Contribute" - -![image](https://github.com/Berry-13/LibreChat/assets/81851188/ab91cf4b-1830-4419-9d0c-68fcb2fd5f5e) - -14. Answer all the questions, and in the "Type of Change" section, add `- [x] Translation support` -15. Create a pull request 🎉 diff --git a/mkdocs.yml b/mkdocs.yml index 93166391a..e3f0acf60 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -92,7 +92,7 @@ nav: - APIs and Tokens: 'install/apis_and_tokens.md' - User Auth System: 'install/user_auth_system.md' - Online MongoDB Database: 'install/mongodb.md' - - Languages: 'install/languages.md' + - Languages: 'install/default_language.md' - Features: - Plugins: - Introduction: 'features/plugins/introduction.md' @@ -115,6 +115,7 @@ nav: - Azure (Terraform): 'deployment/azure-terraform.md' - Contributions: - Documentation Guidelines: 'contributions/documentation_guidelines.md' + - Contribute a Translation: 'contributions/translation_contribution.md' - Code Standards and Conventions: 'contributions/coding_conventions.md' - Testing: 'contributions/testing.md'