Jump to content

Recommended Posts

Once upon time i want to translate mods, for playing with friends, and found that the feature of Project Zomboid its especially encoding, that can not correct support some Languages (for example Cyrillic). Its make me sad, but i found way to solve it.

 

This tutorial learns how to solve this problem, and also contain recommendations to modders for making translator's life simply.

 

 

 

First of all we need tool to edit text. I strongly recommend to use free Notepad++

 

As example i will translate mod by RoboMat "Lockpicking Mod" on Russian language

 

 

1. Install mod as usual in C:\Users\%username%\Zomboid\mods

 

2. In mod folder go to \media\scripts\Mods

 

    This folder contains "Scripts" text files, which adding items in game.

    

    Here in every item, replace parameter "DisplayName" to your translated variant

 

example:

        DisplayName                 =   Bobby Pin,on        DisplayName                 =   Заколка,

    Save and close. If text wont work correct try to switch encoding to "UTF-8 without BOM".

 

    Done.

 

3. Everything other except new items you need to translate manually

 

Open folder "Client", in mod folder, and open every .lua file with Notepad++

 

Usually, shown for player text, get marked by '' or "", and get grey color.

 

Be warn that not every text in code has used to be shown to player.

 

 

 

In this mod you can found Lockpicking_Text.lua with contain all shown text as variables (thx alot to author for good coding)

-- Copyright (C) 2014 by RoboMatLockpicking_Text.lockLevels = { "Very Easy", "Easy", "Average", "Hard", "Very Hard", "Broken" };Lockpicking_Text.brokenLockModal = "You can't pick a broken lock.";Lockpicking_Text.contextBreakDoorLock = "Break Lock";Lockpicking_Text.contextPickDoorLock = "Pick Lock";Lockpicking_Text .contextBreakWindowLock = "Break Lock";Lockpicking_Text .traitNimbleFingers = "Nimble Fingers";Lockpicking_Text .traitNimbleFingersDescription = "Years of experience with opening all kinds of locks.\nFaster lockpicking. Better chances for opening a lock.";Lockpicking_Text .professionBurglar = "Burglar";

If encoding for you language work correct, you can simple replace words in "" to your variant and its be work perfect.

 

 

 

 

 

But for my example i need to use Russian language and when i wrote "абвгдеж" its shown "0123456" (encoding error, even trying to switch encode wont work)

 

And here is the way how to solve this problem:

 

Open "%steamfolder%\steamapps\common\ProjectZomboid\media\lua\shared\Translate\" and choice folder with your localization. For me its "RU".

 

Open UI_RU.txt

 

For beautiful organization you can use multiple text files to store variables, but im lazy and put all in one file (UI_RU.txt) :P (its actually comfortable) 

 

In the end of file BUT BEFORE "}" add your variables for every shown text

 

for me is result as 

UI_ConvertWorld = "Конвертирование мира на новую версию, это может занять некоторое время в течение первой загрузки старого сохранения.",--\\ll//--\\ll//--\\ll//--\\ll//--CUSTOM MODS--\\ll//--\\ll//--\\ll//--\\ll//--\\ll//--\\ll//---- Lockpick modUI_prof_Burglar = "Домушник",UI_NimbleFingers = "Ловкие пальцы",UI_NimbleFingersDescription = "Замки взламываются быстрее. Повышен шанс успешного взлома.",UI_BreakLock = "Выломать замок",UI_PickLock = "Взломать замок";UI_PLVE = "Элементарно",UI_PLE = "Легко",UI_PLA = "Нормально",UI_PLH = "Сложно",UI_PLVH = "Очень сложно",UI_PLBR = "Сломано",UI_LockBroken = "Вы не можете взломать сломаный замок",}

We define text variables and for now we must to substitute text in code and text in translate folder (be warn that every variable name must be unique)

 

with this help lua function

getText("")

its call variables from translate folder and substitute text.

 

How it works:

-- Still?-- Copyright (C) 2014 by RoboMat Lockpicking_Text.lockLevels = { getText("UI_PLVE"), getText("UI_PLE"), getText("UI_PLA"), getText("UI_PLH"), getText("UI_PLVH"), getText("UI_PLBR") };Lockpicking_Text.brokenLockModal = getText("UI_LockBroken");Lockpicking_Text.contextBreakDoorLock = getText("UI_BreakLock");Lockpicking_Text.contextPickDoorLock = getText("UI_PickLock");Lockpicking_Text.contextBreakWindowLock = getText("UI_BreakLock");

By magical way, text which "taken" from translate folder shown correct in game. We did it ^_^

 

If coder wont create separated file with text variables (evil coder?) you can use getText function just in code, its work perfect too. (for example in craft helper mod)

 

 

 

FOR MODDERS: How to make mods to make translator's life simply

 

Store all text in translate folder, and translators be very thankful. If it will in one file, thankfully a lot.

 

"%steamfolder%\steamapps\common\ProjectZomboid\media\lua\shared\Translate\" 

 

Pros:

+ Easy to translate your mod
+ Easy to fix text

+ Solve problem with multilingual (without tons of code)

 

Cons:

- User must manually copy-paste text when installing your mod

- If you force user to replace translate file, his can lost other mods variables (don't do that !!!)

= PZ updates replace translate file (backups prevent f*ckups)

 

 

 

How my translate-store file looks

--\\ll//--\\ll//--\\ll//--\\ll//--CUSTOM MODS--\\ll//--\\ll//--\\ll//--\\ll//--\\ll//--\\ll//---- Lockpick modUI_prof_Burglar = "Домушник",UI_NimbleFingers = "Ловкие пальцы",UI_NimbleFingersDescription = "Замки взламываются быстрее. Повышен шанс успешного взлома.",UI_BreakLock = "Выломать замок",UI_PickLock = "Взломать замок";UI_PLVE = "Элементарно",UI_PLE = "Легко",UI_PLA = "Нормально",UI_PLH = "Сложно",UI_PLVH = "Очень сложно",UI_PLBR = "Сломано",UI_LockBroken = "Вы не можете взломать сломаный замок",-- Craft HelperUI_ChMenu = "Помощник крафта",UI_ChIz = "С предметом ",UI_ChKeep = "Держать ",UI_ChMojete = ", вы можете:",UI_ChTitle = "Помощник крафта для предмета: ",UI_ChOTitle = "Книга рецептов",-- Building modUI_BmBuildMore= "Дополнительные строения",UI_BmStor = "Хранилища",UI_BmFood  = "Еда",UI_BmFurn  = "Мебель",UI_BmBuild  = "Строения", UI_BmGunlock = "Ящик для оружия",UI_BmGunlockDesc = "Храните ваше оружие подальше от детей, особенно если они зомби. ",UI_BmBeDr = "Бежевый шкаф",UI_BmBeDrDesc = "Отличный шкаф для ваших грязных носков. ",--...}

Its easy to navigate and can store lots of translations.

Link to comment
Share on other sites

  • 4 years later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...