This repository contains a quick and easy Python script to generate localizations using GPT. The output is a folder of JSON files that are compatible with both Jotunn and Blaxxun-boop's LocalizationManager. The script uses the gpt-3.5-turbo-1106 GPT model.
- Python >=3.7.1
- GPT api key
- openai python library
- python-dotenv python library
- Clone this repository to your local device.
- Install dependencies:
pip install openai
pip install python-dotenv
- Sign up for a GPT API key here.
- Create an
.env
file in the root directory. - In your
.env
file, enter your API key asOPENAI_API_KEY='your_api_key'
. - In the root directory, replace
English_yourModNameHere.json
with your base language JSON file. - In the valheimLocalization.py file, change the
'English_yourModNameHere.json'
argument to the file name of your base language JSON file. - In the valheimLocalization.py file, change the
'ExampleMod'
argument to your mod name. - Run the file
valheimLocalization.py
- A new folder titled 'Translations' will be created in your projects root directory.
You can generate localizations for many languages or just one. In valheimLocalization.py
, the list valheim_languages
contains all the languages supported by Valheim. Adjust this list to select which languages to generate. For a single language, modify the list to include only that language. To add more languages, append them to the list.