This is an old revision of the document!
Table of Contents
How to Translate 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.
Steps to translate wiki
Reproduce steps carefuly.
Install Python
There is lot of tutorials about how to install the Python, try to find one - it's not difficult.
Get access to Wiki folder
On Arkhalia server there is a folder with the main PHP webpage:
/var/www/html/
It contains subfolder where the Wiki is installed (unpacked):
/var/www/html/wiki
You need the “sh” user access to make changes in that folder (ask Shadow).
Locate the wiki pages folders
All the pages written in Wiki are placed in this folder:
/var/www/html/wiki/data/pages /var/www/html/wiki/data/pages/cs /var/www/html/wiki/data/pages/en /var/www/html/wiki/data/pages/cs_old
You can see that it contains everything which is visible in the “site-map”.
Backup the old "cs" folder
Rename the old “cs” article folder:
mv -R /var/www/html/wiki/data/pages/cs /var/www/html/wiki/data/pages/cs_old2
Configure the Script - The Api key
The Python script for translation is present here:
Arkhalia translation Python script
As you can see, it contains the Configuration which we need to change:
CHATGPT_API_KEY = ""
First we need to put there the Open API key, for which we need to register on:
openai.com/api/
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 = "/Users/jiri/projekty/my_python_scripts/arkhalia_translate/en" OUTPUT_DIRECTORY_ABSOLUTE = "/Users/jiri/projekty/my_python_scripts/arkhalia_translate/cs"
This paths shall be pointing directly to the folders where the input “en” directory and the output “cs” directory (where all the articles will be translated are present)
Configure the Script - The ChatGPT instructions
The last thing which need revisioon are instructions for ChatGPT:
CHATGPT_COMMAND = f""" You are a helpful translator from {INPUT_LANGUAGE_AND_FOLDER_NAME} to {OUTPUT_LANGUAGE_AND_FOLDER_NAME}. The text I will give you to translate is the DokuWiki Article text. It contains some DokuWiki special formatting syntax, like caption "===== Some caption =====", or link to other pages "[[en:ruleset:touch_attack|Dotykový útok]]", or "<WRAP group>". Is is important that during your translation you will not malform the original syntax of the DokuWiki elements. You are smart enough to do it, I know that. Maybe it will be handy for you that the DokuWiki Articles you are going to translate is the community driven DokuWiki related to the game Neverwinter Nights 1 online persistent world. Maybe, if you will be unsure how to translate something, like names of game feats, or spells, it will help you to know it. Also, this is the set of rules I want you to comprehend during the translation: 1. When you encounter a link like "[[en:craftingguide]]", then I want your output to be the exact original version: "[[en:craftingguide]]" 2. When you encounter a link containing custom text like "[[en:craftingguide|This is a custom caption]]", then I want your output to translate the custom caption like this: "[[en:craftingguide|Tohle je custom popisek]]" 3. The word "Feats" shall be translated as "Odbornosti" 3. The word "Classes" shall be translated as "Povolání" 4. Consider not to translate names of some Classes and keep the name original, like "Acolyte of Skin" sounds weird in Czech to be translated. 5. The word "Skills" shall be translated as "Dovednosti" That's all. """
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 targen directory and subpages
Then you need to move the new “cs” directory to the “wiki/data/pages” directory and ensure, that they have proper rights so wiki can access them. As user “sh” execute:
chmod -R a+w cs
Change the sidebar
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:start|🇨🇿 Česky]] [[en:start|🇬🇧 English]]
And that's it
Everything should work now.