JSONLocalizeAPI

版本 v1.0.0·更新於 2025-11-22

A lightweight JSON-based localization library for Necropolis mods. Provides easy multi-language support for mod-specific content.

模組介紹 作者原文

JSONLocalizeAPI

A lightweight JSON-based localization library for Necropolis mods. Provides easy multi-language support for mod-specific content.

What Is This?

JSONLocalizeAPI is a library mod (API mod) that other mods can use to add localization to their custom Necropolis content. It handles:

  • Loading translations from JSON files
  • Runtime language detection (follows Necropolis' language setting)
  • Fallback chains (current language → English → first available)
  • Per-mod translation isolation (each mod has its own translations.json)
  • Translation caching for performance

Core Features

Language Support

  • 8 Languages (Necropolis Default): English, Russian, French, German, Spanish, Italian, Polish, Portuguese (Brazilian.
  • Runtime Detection: Automatically follows game's language setting
  • Partial Translations: Missing languages gracefully fall back to English

Translation Types

  • Random Arrays: GetRandomFromArray() - Toast messages, random dialogue
  • Single Strings: GetFromObject() - UI labels etc.
  • Indexed Arrays: GetFromArrayIndex() - Sequential messages, tutorials

Performance

  • Lazy Loading: Translations load only when first needed
  • Assembly Caching: Each mod's JSON is parsed once and cached
  • No Repeated I/O: Dictionary-based lookups (O(1) performance)

You can safely call API methods frequently without performance concerns.

Security

  • Graceful Fallbacks: Never crashes - always returns valid string
  • Per-Mod Isolation: Each mod has its own translations (no conflicts)
  • Debug Mode: Detailed logging for troubleshooting

Developer Friendly

  • Simple API: 3 methods cover all use cases
  • No Setup Required: Just call the API
  • BepInEx 5.x: Standard modding framework

Installation

For Players

You need to install this so the mods relying on this API can properly display translations.

For Mod Developers

Head over to the mod's GitHub page for detailed documentation.

FAQ

Q: Can I use this to retranslate the game's content?

  • A: Not really. This is only efficient for new content added by your mod - things like button/setting names, dialogue pieces, item descriptions if it's one or two objects. For large scale translations and big amounts of text it's best to use CSVPatcher.

Q: Do I need to bundle JSONLocalizeAPI.dll with my mod?

  • A: No. Just add it as a dependency in manifest.json. Players will download it automatically.

Q: Can multiple mods share one translations.json?

  • A: No. Each mod should have its own. The API keeps them isolated by assembly.

Q: What if my translations.json is missing?

  • A: The API gracefully falls back to your hardcoded strings. Your mod won't crash.

Q: Can I add custom languages not in the game?

  • A: Yes, if another mod adds support for it. The API reads from Necro.UI.Strings.CurrentLang.

Q: Does this work with CSVPatcher mods?

  • A: Yes, they're complementary.

Changelog

1.0.0

  • Initial release

Credits

  • Author: KoMiKoZa

Discord: komikoza

  • SimpleJSON: Bunny83 (MIT License)

Support

  • Website: Mod Documentation
  • Source Code: GitHub
  • Issues: Report bugs on Discord or GitHub Issues

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack_Necropolis

檔案與校驗

檔案名稱
JSONLocalizeAPI-1.0.0.zip
檔案大小
56.1 KiB