Skip to content

Kianyaa/CS2-map-text-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS2 map text translator

Python script that translates [Chinese --> English] map text from StripperCS2 'JSON' format by using Google Translate API

สกรีนช็อต 2025-03-27 022044

Features

  • Support multiple map lump text data files from StripperCS2 format
  • Export Workshop_ID and Workshop Name in json
  • Using Google Translate API for translate

Important

This script support only translate Chinese to English only!

If you provide others langauge, Output will be the same!

Requirements

  • Python (version 3.9.11 atleast)
  • All dependencies in requirements.txt

Installation

Install python and then download this repository, Extract the zip file in any folder and run install.bat file to install all Python dependencies in this script are required

Note

install.bat file will automatically create virtual environment and activate it for you

Warning

If you have a problem with installing dependencies while running install batch file

Try to run pip install pandas requests beautifulsoup4 googletrans in any bash shell

or you can see all libraries using in requirements.txt

How to use

  1. Open PowerShell or CMD on the working directory that has translate_script.py file stored
  2. Type python translate_script.py to run the script (The script will automatically create data and data/export directories)
  3. Put all map lump text data files you want to translate in data and follow the script
  4. Output file will be create at data/export with the same name and same JSON StripperCS2 structure


Example Input of Lump text file 3347418203_text.json

{
  "modify": [
    {
      "match": {
        "io": [
          {
            "overrideparam": "say 左乐:此次前赴大荒城,有博士协助,想必路途会轻松不少"
          }
        ]
      },
      "replace": {
        "io": {
          "overrideparam": ""
        }
      }
    },
    {
      "match": {
        "io": [
          {
            "overrideparam": "say 左乐:博士,前方道路开放还有20s"
          }
        ]
      },
      "replace": {
        "io": {
          "overrideparam": ""
        }
      }
    }
  ]
}

Output of 3347418203_text.json located in \data\export\3347418203_text.json after runing the script

{
  "modify": [
    {
      "match": {
        "io": [
          {
            "overrideparam": "say 左乐:此次前赴大荒城,有博士协助,想必路途会轻松不少"
          }
        ]
      },
      "replace": {
        "io": {
          "overrideparam": "Say Zuo Le: This time I went to Dahuang City, with the help of a doctor, I guess the journey will be much easier"
        }
      }
    },
    {
      "match": {
        "io": [
          {
            "overrideparam": "say 左乐:博士,前方道路开放还有20s"
          }
        ]
      },
      "replace": {
        "io": {
          "overrideparam": "Say Zuo Le: Doctor, the road ahead is open for 20 seconds"
        }
      }
    }
  ]
}

Know-Issue

Sometimes script out with Operation Time Out or Exit code 200 or RunTimeWarning just re-run the script again or put the file want to translate more less

About

Python script that translate Chinese map text to English in StripperCS2 json format by using Google Translate API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors