VirtoolsTranslation/README.md
yyc12345 52ea2745dd [refactor] do some works
- move gitignore in individual directories.
- change some directory layout.
- refactor NlpCodec but not finished.
2024-12-08 23:33:57 +08:00

2.7 KiB

Virtools Translation

Provide I18N feature for an abandoned ancient game engine - Virtools.

According to Virtools directory hierarchy, it should has I18N feature. However, all Virtools distribution, including pirate and official ones, only provide English.nlp as the only I18N file in default. The aim of this project is that let Virtools support more languages by providing more I18N files, e.g. NLP files.

The nature of NLP file is just a Zlib compressed text file with some extra encryptions. After doing decompression and decryption, what we got is a plain text file with specific format. I believe this syntax is invented by Virtools self, because it use a bunch of code to parse this text file according to the decompile result. However, for me, now, I can use various methods to do these things respectively. Each methods is the best solution in its scope. That's the reason why this repository is consisted by a bunch of projects.

Hierarchy

This repository consist of these parts:

  • NlpCodec: The codec for the first step of NLP file processing. It can do decompression and decryption stuff for NLP, also including the reversed operation, decompression and encryption.
  • NlpParser: A Java written ANTLR parser which can recognised the syntax of plain text file output by NlpCodec, and convert it to a neasted JSON format for following processing. Please note we only use this project for vanilla NLP file parsing. New generated NLP files are built by an ordinary Python script because we do not need to process too much special scenarios when writing NLP files.
  • NlpProc: A collection of Python scripts served for this repository.
    • Convert the JSON between the nested JSON output by NlpParser and un-nested JSON (flat JSON / plain JSON) to let it more acceptable for the most of common I18N software.
    • Output NLP text file when compiling translation.

How to Translate

I take zh-cn (Chinese) as a example. Navigate to NlpTr folder first. and you will find following files.

  • VT25.zh-cn.json
  • VT30.zh-cn.json
  • VT35.zh-cn.json
  • VT40.zh-cn.json
  • VT50.zh-cn.json

The only things you need to do is translate these JSON files.

How to Add Language

Contact the owner of repository, or follow the manual NlpTr/README.md when owner went off.

How the Files Generated in NlpTr

This section is not suit for beginner.

  1. Run ./Scripts/compile_codec.sh to compile NlpCodec
  2. Run ./Scripts/compile_parser.sh to compile NlpParser
  3. Run ./Scripts/generate_source.sh to generate the files located in NlpTr.

How We Generate NLP Files when Publishing

This section is not suit for beginner.

  1. Run ./Scripts/compile_codec.sh to compile NlpCodec. Skip if you have compiled.
  2. Run ./Scripts/compile_tr.sh

Can I Use This on Windows

Use MSYS2.