Conversation
Independent language file loading: Instead of putting all languages in one languages.json, create a separate lang_xx.json file for each language (e.g. lang_zh_CN.json, lang_en.json). Simplified translation dictionary: _translations now directly stores the key-value pairs of the current language. Language switcher: Added a language selection button in the UI, and supports real-time loading and switching of languages.
Implementing a localized system
Add English
Localized Language
English Translation
Chinese Translation
Localized Language
Localized Language
Supported language configuration
English, Chinese, Korean, Spanish, Brazilian, French, German, Norwegian (Bokmål) and Russian
The languages.json file should be structured like this:
{
"en": {
"UI.HeroineList": "Heroine List",
"UI.StartGameToSeePlayerCheats": "Start the game to see player cheats.",
"UI.GeneralPlayer": "General Player",
"UI.FishingSkillLevel": "Fishing Skill Level: {0}",
"UI.ShanHeartLevel": "Shan Heart Level: {0}",
"UI.EnableInstantFishing": "Enable Instant Fishing",
"UI.EnableFreeCrafting": "Enable Free Crafting",
"UI.EnablePlayerNoclip": "Enable Player Noclip",
"UI.AllowBuildingAnywhere": "Allow Building Anywhere",
"UI.AllowBuildingOverlap": "Allow Building Overlap",
"UI.WarningPermanent": "Warning: These changes are permanent!",
"UI.UnlimitedInventorySlots": "Unlimited Inventory Slots",
"UI.ClearInventory": "Clear Inventory",
"UI.InventoryCleared": "Inventory Cleared!",
"UI.AddOneItem": "Add 1 of Each Item",
"UI.AddNinetyNineItems": "Add 99 of Each Item",
"UI.ItemsAdded": "{0} items added to inventory.",
"UI.NavigateToPlayer": "Navigate to Player in Object Tree",
"UI.OpenPlayerInInspector": "Open Player in Inspector",
"UI.PlayerNoBodyAssigned": "Player has no body assigned, cannot navigate.",
"UI.Weather": "Weather",
"UI.Next": "Next",
"UI.Temperature": "Temperature: {0}°C",
"UI.GameTime": "Game Time",
"UI.HSceneControls": "H Scene Controls",
"UI.MaleGauge": "Male Gauge",
"UI.FemaleGauge": "Female Gauge",
"UI.OpenHSceneFlagsInInspector": "Open H Scene Flags in Inspector",
"UI.HSceneFlagCtrl": "H Scene Flag Ctrl",
"UI.Heroines": "Heroines",
"UI.SelectHeroine": "Select Heroine {0}: {1}",
"UI.SelectHeroineToAccessStats": "Select a heroine from the list to access her stats.",
"UI.SelectedHeroineName": "Selected Heroine: {0}",
"UI.Status": "Status",
"UI.Sickness": "Sickness",
"UI.Heal": "Heal",
"UI.DesiresMotivations": "Desires & Motivations",
"UI.FlavorSkills": "Flavor Skills",
"UI.ResetTalkTime": "Reset Talk Time",
"UI.NavigateToActor": "Navigate to Actor in Object Tree",
"UI.OpenActorInInspector": "Open Actor in Inspector",
"UI.Actor": "Actor: {0}",
"UI.InspectExtendedData": "Inspect Extended Data",
"UI.ExtDataFor": "Extended Data for {0}",
"UI.Language": "Language",
"Game.Weather.Clear": "Clear",
"Game.Weather.Cloudy": "Cloudy",
"Game.Weather.Rain": "Rain",
"Game.Weather.Storm": "Storm",
"Game.Weather.Snow": "Snow",
"Game.Status.LovePhase": "Love Phase: {0}",
"Game.Status.SicknessNone": "None",
"Strength": "Strength",
"Stamina": "Stamina",
"Intellect": "Intellect",
"Spirit": "Spirit",
"Dexterity": "Dexterity",
"Agility": "Agility",
"Perception": "Perception",
"Luck": "Luck",
"HP": "HP",
"MP": "MP",
"Energy": "Energy",
"Hunger": "Hunger",
"Thirst": "Thirst",
"Purity": "Purity",
"Stress": "Stress",
"Hygiene": "Hygiene",
"Pleasure": "Pleasure",
"Arousal": "Arousal",
"Affection": "Affection",
"Submission": "Submission",
"Discipline": "Discipline",
"Curiosity": "Curiosity",
"Morality": "Morality",
"Lust": "Lust",
"Fear": "Fear",
"PainTolerance": "Pain Tolerance",
"Speech": "Speech",
"Combat": "Combat",
"Survival": "Survival",
"Crafting": "Crafting",
"Cooking": "Cooking",
"Fishing": "Fishing",
"Hunting": "Hunting",
"Gardening": "Gardening",
"Medicine": "Medicine",
"Exploration": "Exploration",
"Social": "Social",
"Stealth": "Stealth"
},
"zh_CN": {
"Heroine list": "女主角列表",
"Manager.ADV.Instance": "ADV管理器实例",
// ... // ... Other Chinese translations (can be kept for completeness)
}
}
Create a languages.json file, its structure should look like this:
{
"zh_CN": {
"Heroine list": "女主角列表",
"Manager.ADV.Instance": "ADV管理器实例",
// ... 其他中文翻译
"General / Player": "通用 / 玩家",
"Fishing skill lvl: ": "钓鱼技能等级:",
"Shan heart lvl: ": "沙恩好感度等级:",
"Enable instant fishing": "启用即时钓鱼",
"Enable free crafting": "启用自由制作",
"Enable player noclip": "启用玩家穿墙",
"Allow building anywhere": "允许随处建造",
"Allow building items to overlap": "允许物品重叠建造",
"Warning: These can't be turned off!": "警告:这些无法关闭!",
"Unlimited inventory slots": "无限物品栏位",
"Clear player inventory": "清空玩家物品栏",
"Your inventory has been cleared.": "你的物品栏已被清空。",
"Get +1 of all items": "获得所有物品+1",
"+99": "+99",
"items have been added to your inventory": "件物品已添加到你的物品栏。",
"Navigate to Player's GameObject": "导航到玩家的游戏对象",
"Player has no body assigned": "玩家未分配身体",
"Open Player in inspector": "在检查器中打开玩家",
"Weather: ": "天气:",
"Weather.Clear": "晴朗",
"Weather.Rain": "下雨",
"Weather.Cloudy": "多云",
// ... 根据你的 Weather 枚举添加其他天气类型
"Clear": "晴朗",
"Next": "下一个",
"Temperature: ": "温度:",
"Game time:": "游戏时间:",
"H scene controls": "H场景控制",
"Male Gauge: ": "男性欲望值:",
"Female Gauge: ": "女性欲望值:",
"Open HScene Flags in inspector": "在检查器中打开H场景旗标",
"Heroines": "女主角",
"Select a heroine to access her stats": "选择一个女主角来查看其状态",
"Selected heroine name: ": "已选择女主角名称:",
"Status": "状态",
"Love phase: ": "爱恋阶段:",
"Sickness: ": "疾病:",
"Heal": "治疗",
"Desires & Motivations": "欲望与动机",
"Flavor skills": "风味技能",
"Reset talk time": "重置对话时间",
"Navigate to Actor's GameObject": "导航到角色的游戏对象",
"Actor has no body assigned": "角色未分配身体",
"Open Actor in inspector": "在检查器中打开角色",
"Inspect extended data": "检查扩展数据",
"ExtData for ": "扩展数据:"
},
"en": {
"Heroine list": "Heroine list",
"Manager.ADV.Instance": "Manager.ADV.Instance",
// ... Other English translations (these can be omitted if English is the default, but are kept for completeness)
}
}
|
|
Introduced Newtonsoft.Json: This is a widely used .NET library for serializing and deserializing JSON, which is very suitable for loading external language files. |
Improved the default setting of expected language options when loading languages.json fails or the file does not exist
@ManlyMarco Hello, I’ve tested and found that XUnity.AutoTranslator-IL2CPP currently does not support IMGUI translation. May I ask if there are any alternative solutions available? |
|
@ceshizhuanyong895 I don't know of anything other than modifying the plugin dll itself at this time. |
Got it, I understand. Looking forward to seeing the masterpieces from all the talented experts. |
English translation
Chinese translation
Laying the foundation for localized languages