Skip to content

iamkem/DS3-Archthrones-Translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

translate_ai

Mô tả dự án

translate_ai là một tập hợp script Python nhỏ dùng để trích xuất, chuyển đổi và gộp nội dung file văn bản định dạng .fmg.txt (thường là file văn bản dùng cho các trò chơi) sang định dạng JSON dễ xử lý. Mục tiêu chính là chuẩn hóa dữ liệu văn bản để phục vụ việc dịch thuật, chỉnh sửa nội dung hoặc tái sử dụng trong các công cụ khác.

Tính năng chính

  • Đọc các file .fmg.txt từ các thư mục đầu vào (ví dụ: item/, menu/).
  • Chuyển đổi nội dung thành JSON có cấu trúc (ví dụ: extracted/talk_messages.json).
  • Gộp nhiều nguồn đầu vào vào một file JSON hợp nhất (ví dụ: merged/talk_messages.json).

Sơ đồ thư mục (mô tả các file quan trọng)

  • main.py — (giả định) entrypoint chính của dự án để chạy luồng xử lý chính.
  • merge_fmg_text_to_json.py — script để gộp các file .fmg.txt/thành JSON (tên file có thể biểu thị chức năng gộp).
  • item/, menu/ — thư mục chứa các file .fmg.txt thô (dữ liệu nguồn).
  • extracted/talk_messages.json — kết quả trích xuất định dạng JSON (một ví dụ có sẵn trong repo).
  • merged/talk_messages.json — kết quả sau khi gộp nhiều nguồn (ví dụ đầu ra hợp nhất).

Ghi chú và giả định

Một vài giả định hợp lý (vì repo không kèm tài liệu chi tiết về CLI nội bộ):

  1. main.pymerge_fmg_text_to_json.py là script Python có thể chạy trực tiếp bằng python3.
  2. Kết quả đầu ra được lưu trong thư mục extracted/ hoặc merged/ như đã thấy trong repo.

Nếu những giả định trên không chính xác, hãy cho biết cách gọi cụ thể và mình sẽ cập nhật README tương ứng.

Yêu cầu

  • Python 3.8+ (khuyến nghị). Nếu script sử dụng thư viện ngoài, hãy thêm requirements.txt. Hiện tại README này giả định không có phụ thuộc ngoài.

Hướng dẫn nhanh — chạy các script

Mở terminal (shell mặc định của bạn) và chạy:

python3 main.py
# hoặc (nếu bạn chỉ muốn gộp file .fmg.txt thành JSON)
python3 merge_fmg_text_to_json.py

Kết quả mong đợi

  • Các file JSON mới sẽ xuất hiện trong extracted/ hoặc merged/.
  • Kiểm tra nội dung JSON (ví dụ: extracted/talk_messages.json) để đảm bảo các key/giá trị phù hợp.

Cách hoạt động (tổng quan)

  1. Script đọc từng file .fmg.txt trong các thư mục nguồn.
  2. Phân tích cú pháp (parser) để tách các entry/ID/nội dung.
  3. Chuyển mỗi entry thành object JSON với các trường phù hợp.
  4. Ghi các object này vào file JSON đầu ra (có thể gộp nhiều file vào một danh sách lớn hoặc map theo ID).

Ví dụ nhanh

  • Nguồn: menu/1.fmg.txt, item/20.fmg.txt
  • Chạy python3 merge_fmg_text_to_json.py
  • Đầu ra: merged/talk_messages.json

Đóng góp

  • Muốn thêm tính năng (ví dụ: hỗ trợ charset khác, xuất CSV, cờ CLI), hãy mở issue hoặc gửi pull request.
  • Nếu thêm phụ thuộc, bổ sung requirements.txt và cập nhật README.

Các bước tiếp theo đề xuất

  • Thêm mô tả từng script (CLI flags, ví dụ sử dụng) trực tiếp trong README.
  • Thêm requirements.txt nếu cần thư viện ngoài (ví dụ: regex, click).
  • Viết test nhỏ để kiểm tra parser hoạt động với vài file .fmg.txt mẫu.

English

Project description

translate_ai is a small collection of Python scripts for extracting, converting, and merging text files in the .fmg.txt format (commonly used for game text) into JSON that is easier to process. The main goal is to normalize text data for translation, content editing, or reuse in other tools.

Key features

  • Read .fmg.txt files from input folders (for example: item/, menu/).
  • Convert content into structured JSON (for example: extracted/talk_messages.json).
  • Merge multiple input sources into a single unified JSON file (for example: merged/talk_messages.json).

Repository layout (important files)

  • main.py — (assumed) the primary entrypoint to run the main processing flow.
  • merge_fmg_text_to_json.py — script for merging .fmg.txt files into JSON (file name suggests merge functionality).
  • item/, menu/ — folders containing raw .fmg.txt source files.
  • extracted/talk_messages.json — an example extraction output in JSON format.
  • merged/talk_messages.json — an example of merged output from multiple sources.

Notes and assumptions

A few reasonable assumptions (since the repo doesn't include detailed CLI docs):

  1. main.py and merge_fmg_text_to_json.py are runnable Python scripts executed with python3.
  2. Output files are written to extracted or merged as seen in the repository.

If these assumptions are incorrect, please tell me how the scripts are intended to be run and I'll update the README accordingly.

Requirements

  • Python 3.8+ (recommended). If the scripts rely on external libraries, add a requirements.txt. This README assumes there are no external dependencies.

Quick start — run the scripts

Open a terminal and run:

python3 main.py
# or (if you only want to merge .fmg.txt files into JSON)
python3 merge_fmg_text_to_json.py

Expected output

  • New JSON files will be created under extracted/ or merged/.
  • Inspect the JSON content (for example: extracted/talk_messages.json) to ensure keys/values match expectations.

How it works (overview)

  1. The scripts read each .fmg.txt file in the source folders.
  2. A parser extracts entries/IDs and their text content.
  3. Each entry is converted into a JSON object with appropriate fields.
  4. The objects are written to an output JSON file (either combined into a list or mapped by ID).

Quick example

  • Sources: menu/1.fmg.txt, item/20.fmg.txt
  • Run python3 merge_fmg_text_to_json.py
  • Output: merged/talk_messages.json

Contributing

  • To add features (for example: support for additional encodings, CSV output, CLI flags), open an issue or submit a pull request.
  • If adding dependencies, update requirements.txt and the README.

Suggested next steps

  • Add detailed script documentation (CLI flags and usage examples) directly in the README.
  • Add requirements.txt if external libraries are needed (for example: regex, click).
  • Create small tests to validate the parser with a few sample .fmg.txt files.

About

Dark Souls 3 Archthrones Việt Hóa

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages