en:autotranslation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:autotranslation [2025/06/06 07:46] – juras17 | en:autotranslation [2025/06/07 09:58] (current) – [Chmod the targen directory and subpages] juras17 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to translate | + | ====== How to Translate the Wiki ====== |
The original Wiki version is written in the English language and the Czech version is the result of the automatic translation using Open AI. | The original Wiki version is written in the English language and the Czech version is the result of the automatic translation using Open AI. | ||
Line 5: | Line 5: | ||
===== Steps to translate wiki ===== | ===== Steps to translate wiki ===== | ||
- | ==== 1. Install Python ==== | + | Reproduce steps carefuly. |
- | There is lot of tutorials about how to install the Python, try to find one - it's not difficult. | + | ==== Install |
- | ==== 2. Get access to Wiki folder ==== | + | There is lot of tutorials about how to install the Python, try to find one - it's not difficult. The Python version shall be about 3.7 and higer. Don't forget to install libraries - which one ou will know if you try to execute the script. Paste the error to ChatGPT if you will don't know wha to do. |
+ | |||
+ | ==== Get access to Wiki folder ==== | ||
On Arkhalia server there is a folder with the main PHP webpage: | On Arkhalia server there is a folder with the main PHP webpage: | ||
Line 25: | Line 27: | ||
You need the " | You need the " | ||
- | ==== 3. Locate the wiki pages folders ==== | + | ==== Locate the wiki pages folders ==== |
All the pages written in Wiki are placed in this folder: | All the pages written in Wiki are placed in this folder: | ||
Line 38: | Line 40: | ||
You can see that it contains everything which is visible in the " | You can see that it contains everything which is visible in the " | ||
- | ==== 4. Backup the old " | + | ==== Backup the old " |
Rename the old " | Rename the old " | ||
Line 47: | Line 49: | ||
- | ==== 5. Configure the Script - The Api key ==== | + | ==== Configure the Script - The Api key ==== |
The Python script for translation is present here: | The Python script for translation is present here: | ||
Line 58: | Line 60: | ||
< | < | ||
CHATGPT_API_KEY = "" | CHATGPT_API_KEY = "" | ||
+ | </ | ||
+ | |||
+ | First we need to put there the Open API key, for which we need to register on: | ||
+ | |||
+ | < | ||
+ | openai.com/ | ||
+ | </ | ||
+ | |||
+ | We have to add there billing method, or you can write me (Jurass17) and I will provide mine. One translation of the Wiki cost approx. <1 dollar. | ||
+ | |||
+ | ==== Configure the Script - The input and output folder ==== | ||
+ | |||
+ | As you can see in script: | ||
+ | |||
+ | < | ||
INPUT_DIRECTORY_ABSOLUTE = "/ | INPUT_DIRECTORY_ABSOLUTE = "/ | ||
OUTPUT_DIRECTORY_ABSOLUTE = "/ | OUTPUT_DIRECTORY_ABSOLUTE = "/ | ||
- | INPUT_LANGUAGE_AND_FOLDER_NAME = " | + | </ |
- | OUTPUT_LANGUAGE_AND_FOLDER_NAME = " | + | |
+ | This paths shall be pointing directly to the folders where the input " | ||
+ | |||
+ | ==== Configure the Script - The ChatGPT instructions ==== | ||
+ | |||
+ | The last thing which need revisioon are instructions for ChatGPT: | ||
+ | |||
+ | < | ||
CHATGPT_COMMAND = f""" | CHATGPT_COMMAND = f""" | ||
You are a helpful translator from {INPUT_LANGUAGE_AND_FOLDER_NAME} to {OUTPUT_LANGUAGE_AND_FOLDER_NAME}. | You are a helpful translator from {INPUT_LANGUAGE_AND_FOLDER_NAME} to {OUTPUT_LANGUAGE_AND_FOLDER_NAME}. | ||
Line 84: | Line 107: | ||
That's all. | That's all. | ||
""" | """ | ||
+ | |||
</ | </ | ||
- | === a.) Change | + | This is **the entire order** for the ChatGPT, which is used for translating each single one page. As you can see, at the bottom we have specified several specific instructions about what it shall do. You can add your own if you think that the translation results are not good enough. |
+ | |||
+ | |||
+ | ==== Execute the script ==== | ||
+ | |||
+ | Then finally, you can execute the script running something like: | ||
+ | |||
+ | < | ||
+ | python3 -m thescript.py | ||
+ | </ | ||
+ | |||
+ | You shall see the pages are created in the target directory. It takes several minutes. | ||
+ | ==== Chmod the target directory and subpages ==== | ||
+ | |||
+ | Then you need to move the new " | ||
+ | |||
+ | < | ||
+ | chmod -R a+w cs | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Change | ||
+ | |||
+ | One last thing, in the new czech version sidebar, you have to manually change the link to the english version of the Wiki as follow: | ||
+ | |||
+ | < | ||
+ | ** Obsah ** | ||
+ | |||
+ | [[cs: | ||
+ | [[en: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== And that's it ===== | ||
+ | |||
+ | Everything should work now. |
en/autotranslation.1749196012.txt.gz · Last modified: 2025/06/06 07:46 by juras17