Maris Posted September 27, 2016 Share Posted September 27, 2016 (edited) The main idea is that a mod can determine the existence of the language pack on the client side. Then the mod can translate phrases and names of items only for that user (client-side). The difficulty lies in the fact that the phrase is sent entirely over the network. Therefore, as a solution we should create a lookup table. A string in English comes from the server, and it is replaced by the phrase from the table. Names of items and descriptions of recipes can be safely changed locally. But we want a nice unified solution to make our translations of items, recipes, phrases etc. I think one file for each language is nice enough, isn't it? http://pastebin.com/9ahhHQ3D Here is the mini code. You should copy&paste it into your modmain. Then you should change it for your mod: LANG_FILE_PREFIX - is the prefix of your language files, e.g. yourmod_en.lua where prefix is "yourmod_" SUPPORTED_LANGS - list of supported language signs. Each sign is defined by language pack. You can find it in modmain of any language pack in line with "LoadPOFile" function. TEST_LANG - uncomment this line if you want to test some language file without installing specific language pack. After that make files for translations including English language, i.e. yourmod_en.lua file. Use aliases for initialization string values: nm - for names of items (instead of STRINGS.NAMES) desc - for description phrases of items and other objects (by prefab name as usual) rec - description for recipe in recipe tab (instead of STRINGS.RECIPE_DESC) actf - special alias for action fail strings (instead of STRINGS.CHARACTERS.GENERIC.ACTIONFAIL) ch - for personal phrases by character (e.g. ch.WILLOW.DESCRIBE.SOMEITEM = "...") Also you can use the function AddPhrase() directly (only for phrases). Example mod: Kindling Fire (v0.24+). Examples of language files: Edited September 29, 2016 by Maris Link to comment https://forums.kleientertainment.com/forums/topic/70488-how-to-translate-your-mod-into-other-languages/ Share on other sites More sharing options...
Arlesienne Posted September 28, 2016 Share Posted September 28, 2016 Wait, wait, wait, you aren't suggesting automated translations, are you? Link to comment https://forums.kleientertainment.com/forums/topic/70488-how-to-translate-your-mod-into-other-languages/#findComment-819584 Share on other sites More sharing options...
Maris Posted September 29, 2016 Author Share Posted September 29, 2016 Yes, I am. Link to comment https://forums.kleientertainment.com/forums/topic/70488-how-to-translate-your-mod-into-other-languages/#findComment-820039 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now