PDA

View Full Version : Translation Tool



knarox
04-16-2016, 11:25 AM
Hi everyone,

i wrote a translation tool and want to share not only the program with you - the c# source code you will get too :).

The program reads the two translation files:

Localisation.txt
Localisation - Quests.txt


By the way it can read all txt/csv files with have a header and data seperated by comma;
The program reads the file and shows all entries in a list and the fields on the right in textboxes to edit.

All graphics are made by myself - hope i can bring some 7d2d feeling in the program :)



First a pic:
14968

SourceCode and Program:https://www.sendspace.com/filegroup/0rP2wbWrta%2BifXhqbFLl7g

How to install:
Download the "7D2Die Translator" and extract the file where ever you want. Its only important, that the "pics" folder is at the same location as the exe-file. Then start the translator.

How to use:
1. Open the language file Localisation.txt or Localisation - Quests.txt by clicking on the "..." button on the right. NOTE: Standard location is c:\Program Files\steam\steamapps\common\7 Days To Die\Data\Config
2. After the file is loaded you can edit the entries.
2.1 NOTE: Only edit the values in the language section
3. Save it by clicking on "File" and then "Save"
4. Done :)

Adding a new language:
1. Start programm
2. Click "File" -> "add new Language"
2.1 if no file is selected the programm ask you to open the localization file
3. Give your language a name
4. Click "adding new language"
5. Done :)
---


Actual version: 26.01.2018 10:44:42

UPDATE:
- added possibility to ad a new languages

UPDATE 2:
- Fixed: not saving correct when search was used
- Fixed: When file was loaded and then new file-choose-dialog was opend again, but aborded the program has and empty list
- Changed: you dont need the pics folder now. You can delete it or rename to start the program without background blood pic.

UPDATE3:
- Fixed: you dont have to save each time. Only one time at the end by using save from the menu.

UPDATE 4:
- Added: Possibility to add new entries

UPDATE :26.01.2018 10:44:42
- changed: Button "add a new entry" location is now allways on button
- fixex: Crash when their is now pair of "-characters: displaying the line in the file where the error happens
- changed: way of versioning: in stead of x.y its now the building timestamp

UPDATE :18.02.2018 09:09:00
- changed: background image deactivated. Add a picture (.png) with the name "background" to it to have one.
- added: new tab that shows errors that happens while loading file.
- little prerformance teak
---

This maybe strange but now i have translation tool for easy translation but i dont know where to change the language in game :D - any hints?

For a update in the future i would like to add new languages to the file but i cant test it when i dont know where to change the language in game.

---

Maybe you can give me some feedback.

greeting
knarox

knarox
04-17-2016, 05:41 PM
Hi all i added the possibility to add a new language :)

Dos
04-18-2016, 12:11 PM
Hi Knarox,

your translation tool sounds pretty cool.
But unfortunately I can not start it.
While trying to start nothing happens. Although the Windows Explorer works, but unfortunately without success. Also start as admin makes no difference.
Any idea why this may be?
Still needs some program be installed?

I used Windwos 10 operating system.

thank you

knarox
04-18-2016, 04:58 PM
Hi Dos,

sorry i uploaded the wrong files that dont includes the pic folder. Thats why the application dont started.
Should be working now :)

n2n1
04-24-2016, 08:01 PM
Thanks for the Utility!
I will use her for convenient editing names of blocks and the description!

knarox
04-25-2016, 03:54 PM
Thanks for the Utility!
I will use her for convenient editing names of blocks and the description!

Nice to hear. Please report issues and suggestions if present.

n2n1
05-03-2016, 02:20 AM
bug report for use in A14.6 version.
when renaming - "Wood" to "woodPlank". After save - file was an incomplete piece, starting with "Wood". :confused:

knarox
05-03-2016, 03:35 PM
bug report for use in A14.6 version.
when renaming - "Wood" to "woodPlank". After save - file was an incomplete piece, starting with "Wood". :confused:

Should be fixed now - thx for your feedback! :)

n2n1
05-04-2016, 01:33 AM
UPDATE2:
- Fixed: not saving correct when search was used

Yes, i was used search. I check - work properly now!

If i edit and switch to another line - it seems the previous is lost ( I save after edit every line, for confidence), it's feature which confuses me.

I don't use your program for its intended purpose.
Here are some ideas:
- for convenience, the save button can be put on the panel.
- if you add the ability "add line" to Localization.txt, with parameters - it will be the Modding Tools ! :)

Thank you!

knarox
05-04-2016, 07:16 PM
Yes, i was used search. I check - work properly now!

If i edit and switch to another line - it seems the previous is lost ( I save after edit every line, for confidence), it's feature which confuses me.

I don't use your program for its intended purpose.
Here are some ideas:
- for convenience, the save button can be put on the panel.
- if you add the ability "add line" to Localization.txt, with parameters - it will be the Modding Tools ! :)

Thank you!

Update three contains that you dont have to save everytime. Every changes will be noted and saved. At the end you have to save.
So you load the file. Edit it as much as you want without saving. At end you save and all changes are save to file.
:)

So i think we dont need the extra save-button right?

Last purpose i dont get it.
With new line you mean a new line right side of the program right? For example there are "Key, Source, Context, English, Fraincais, German". So you want to add there for example "spain" - so that you have: "Key, Source, Context, English, Fraincais, German, Spain" - right? - if this is the case, you can just use the option "add new language" unter "File" -> "add new language" and this will add you that "line".

n2n1
05-04-2016, 11:06 PM
Thanks again!



Last purpose i dont get it.
With new line you mean a new line right side of the program right? For example there are "Key, Source, Context, English, Fraincais, German". So you want to add there for example "spain" - so that you have: "Key, Source, Context, English, Fraincais, German, Spain" - right? - if this is the case, you can just use the option "add new language" unter "File" -> "add new language" and this will add you that "line".
clarify:
this possibility could be introduced for modders that add new items and blocks. They are not listed in Localization.txt. therefore, in Localization.txt I manually added lines like these:

stick,item,item,,Stick,,
stickDesc,item,item,,Sticks - great for building tools !.,,
or

sharpstone,item,item,,Sharpstone,,
sharpstoneDesc,item,item,,Sharpstone - for your StoneAxe better than simple dumbStone!!!.,,

This feature can be useful for adding new quests, who is doing it...maybe...


PS: 20 years ago I coded in ASSM, for processors i8080, and some for i80386. That was awesome. But now the ASSM is useless...Now I envy those who can write Programs for themselves like that.
How do you use your knowledge of C# ?

knarox
05-05-2016, 07:37 AM
Thanks again!


clarify:
this possibility could be introduced for modders that add new items and blocks. They are not listed in Localization.txt. therefore, in Localization.txt I manually added lines like these:

stick,item,item,,Stick,,
stickDesc,item,item,,Sticks - great for building tools !.,,
or

sharpstone,item,item,,Sharpstone,,
sharpstoneDesc,item,item,,Sharpstone - for your StoneAxe better than simple dumbStone!!!.,,

This feature can be useful for adding new quests, who is doing it...maybe...


PS: 20 years ago I coded in ASSM, for processors i8080, and some for i80386. That was awesome. But now the ASSM is useless...Now I envy those who can write Programs for themselves like that.
How do you use your knowledge of C# ?


Sorry that i dont get it right - maybe it was too late yesterday.
Clear and logical that you meant it that way. And the good news: i added this feature.

ASSM its assembler programming or? So you have to look always on your stack and popping :).
I am happy not to program in this way - is to hardware close for me.
I am working as a programmer in a small company and writing my first programs.

n2n1
05-05-2016, 09:26 PM
And again, Thank You!

You almost finished writing the program for me, I hope what I asked will be helpful for others!



ASSM its assembler programming or? So you have to look always on your stack and popping :).
I am happy not to program in this way - is to hardware close for me.
Yes, it was Assembler...Interrupts, the stack, working with registers...A lot of work - the result is not enough... :)

now I dive into work for my Mod :)
I do this now (https://7daystodie.com/forums/showthread.php?40556-CLASSIC-Style-HARDCORE) and your program helps me. Thank!

knarox
05-06-2016, 06:38 AM
The program feels better now and have good nice features :)
I was not thinking of the modding aspect, that why i dont have a option to add new entities, but now its in :)

Why you say "almost finished" you missed something else?

Your mod looks good and like a lot of work - i wish you good look with it! And i am happy that at least one person is using my little program :) - you dont know how to change the language in game or found a configfile where you can change it?

n2n1
05-06-2016, 07:00 AM
aaaa....language translation...
I wanted to say - "almost only for me" :)


you dont know how to change the language in game or found a configfile where you can change it?
I always thought that it depends on the steam-client or in the registry...perhaps,this cannot be done because no translation has , in Localization.txt - English only. On that switch ?
(I saw "language" parametr in the registry)


PS: you know what utility edit - Assembly-CSharp.dll ? Using "ILSpy" I can see them , but can't edit.

knarox
05-06-2016, 09:16 AM
Yes i saw, that no translation exits - only english. There is just the structure done but not filled.
Thats i thought "oh its empty but a simple csv-file - would be more easy with a tool" :)

Now the translation tool is ready but without a solution to change the language... at least you can you my tool to edit all other stuff in it and not only the translation.

Good implementation would be the the game reads always the english part if the choosen language not fill with some text.
So if you use a "german" version, but not all is translated the not translated will be shown in english - maybe with a hint, that the translation isnt complete.

EDIT

yes its seems in some dll but we need a language switcher in a configfile or something thats easy to edit. Or later in game.

EDIT2
yes i found it in the regestry:
Language_h3872303031

0000 45 6e 67 6c 69 73 68 00 English.
0008


EDIT3
tried to edit it into German, but the game change it after launching.
I think this i somehow the option to edit.

knarox
06-07-2016, 08:30 AM
Sorry i have no idea how to change the language at the moment.
I think we have to wait unti this is possible to change in the game again.

orlydb
11-05-2017, 04:51 AM
Can you reupload your source?

knarox
12-04-2017, 03:49 PM
I uploaded it again. Nice to see that my program is still useful :)
Check the updated link in the first post.

bigstep70
12-04-2017, 04:13 PM
I uploaded it again. Nice to see that my program is still useful :)
Check the updated link in the first post.

This app is awesome. Thank you knarox.
I have been using it to add descriptions for 'custom' items that I have created vs. manually editing the loc/quests files.
Another thing that i did with my A15 loc/quests files is that i removed all the "not my native" languages and I did notice an improvement in menu responce speed. It was just an experiment at first but I had a theory and wanted to prove it to myself and I was right (partially).

By removing all the text that was "not needed" aka french, german, spanish and klingon (haha) the game does not have to 'read' all of that extra text/characters to get to its/your desired output, therefore reducing menu delay.

The results were pretty amazing and very noticable. I will say this though, the localization file is huge and it takes a long time to completely 'clean' the file properly. So I also used a search/replace (via notepad++ and a bit of wildcard * factoring) for sections that has similar phrasing.

I have yet to tackle my A16 files but it is an 'optimization' that I will be getting to shortly.
As always if your gonna try this ... BACKUP the file(s) first.

Once again, Thanx for the great program.

n2n1
12-04-2017, 07:12 PM
...
By removing all the text that was "not needed" aka french, german, spanish and klingon (haha) the game does not have to 'read' all of that extra text/characters to get to its/your desired output, therefore reducing menu delay.

You mean that it will reduce the lag for mods who have a lot of recipes ?

bigstep70
12-04-2017, 07:34 PM
You mean that it will reduce the lag for mods who have a lot of recipes ?

Yes, thats what I noticed... its not a huge difference but as the localization file get "fuller and fuller" the game routines have to 'read' thru all those extra letters to get to what you are looking for/at

example
cambelsSoup,item,food,kgnone,cambels soup,Cambel Soup tastes really really really really really really really really really really good.,,,,
vs.
cambelsSoup,item,food,kgnone,cambels soup,Cambel Soup tastes good.

so you see my thinking/theory as to why omitting/removing un-needed values will speed up the display

on a lighter note... if I spoke Klingon then all my menus would be in Klingon, but alas, I only speak english

n2n1
12-04-2017, 08:41 PM
Hmmm....Thanks for the info!
I think, i know how to test this quickly - I cleared a large part of the Localization.txt and see what is the result.

PS: :D only now i noticed about Klingon language :D

bigstep70
12-04-2017, 08:46 PM
yeah i have not done "major" testing
I just pulled out languages that I cant read and slimmed down some of the descriptions, as Ive played long enough to know what certain items and blocks do... in reality I could probably blank/erase 90% of the file and still be able to play

side note :: this is all just me "messing" with things to optimize gameplay for my old-a$$ PC... like 10 year old mobo and cpu... so i try every thing i can to squeeze performance from the game
I should have been a data-analyist/consolidator

knarox
12-05-2017, 04:20 PM
Strange that a overloaded xml file the gamw slows down.
XML reading is in normal case independent from the total size of xml file. You normaly using xpath or something to read direct your translations.

n2n1
12-07-2017, 06:38 PM
No, unfortunately the reduction of the content Localization.txt does not affect the lag for search recipes.

Scomar
01-20-2018, 12:15 PM
Hi,

i would translate an mod localisation. While loading the txt file the translator canceled it, whenever a line in the english section startet with ".

Can you fix it?

MfG Scomar

knarox
01-26-2018, 10:53 AM
Hi,

i would translate an mod localisation. While loading the txt file the translator canceled it, whenever a line in the english section startet with ".

Can you fix it?

MfG Scomar

Hi,

i cant reproduce this issue.
I loaded the "Localization.txt" file and had no error, also with starting "-character.
But if you have only on "-character the programm will crash because they have to be always in pairs. Maybe in your file is a "-character missing.

I fixed this kind of crash and showing you in which line the error happens in a MessageBox. Maybe this helps.
New version of the program is in the first post. i also changed the way of showing the version number - its now just automatically the last building datetime.


Greetings
knarx

Scomar
02-10-2018, 03:48 PM
Hi again,

thx for updating. now the program shows the error and then continue with reading the other lines.

i have attached the localization.txt for you, it's from the Ravenhearst Mod. This one makes the error. If you want to check it yourself, you can do this now. ;)

Greetings
Scomar

P.S. if i want so safe, it says the index is outside the Arrayfield and didn't safe to the file

knarox
02-11-2018, 01:44 PM
I found the problem:

you have to put the new line ("\n") into the quotations chars like:
springDesc,items,Item,EnChanged,"Springs are great for making furniture, vault doors, hatches and more.\n [ Crafted in Advanced Workbench. ]",,"Schraubenfedern eignen sich prima dazu, Möbel, Tresortüren, Klappen und mehr zu fertigen.",,

and not like:
springDesc,items,Item,EnChanged,"Springs are great for making furniture, vault doors, hatches and more."\n [ Crafted in Advanced Workbench. ],,"Schraubenfedern eignen sich prima dazu, Möbel, Tresortüren, Klappen und mehr zu fertigen.",,

The second example cant be read by the translator, because the quatation is over and all following stuff is interpredted as new part but it isnt.


Greetings
knarox

Scomar
02-11-2018, 02:27 PM
Thx, now i can fix this and continued with translating.

Greetings
Scomar

knarox
02-16-2018, 07:50 AM
So i guess now all is working fine.
If ther should be some space for improvement you can notice here.
Im not happy with the dialog box thats showing the error - maybe i will list them instead, so you dont have to click ok each time.

knarox
02-18-2018, 09:17 AM
Updated the program:
UPDATE :18.02.2018 09:09:00
- changed: background image deactivated. Add a picture (.png) with the name "background" to it to have one.
- added: new tab that shows errors that happens while loading file.
- little prerformance teak

Have a nice day :)

Scomar
02-23-2018, 11:48 AM
the log-tab is just great, good work @knarox :)

Code6
04-14-2018, 07:13 PM
I am trying to create an Esperanto translation for 7 Days To Die and I came across this thread. I found the localization.txt file and used it to create Esperanto versions of the strings.
But now I am stuck with actually trying to get it to work in the game.

1. As mentioned in other parts of this thread, there doesn't appear to be any way to choose other languages for the game. So I just copied my Esperanto text over the English column in the file. While not elegant, it did allow me to change the text in game.

2. My bigger hurdle at the moment is that Esperanto uses a slightly different alphabet than English. It contains a few letters (ĉ, ĝ, ĥ, ĵ, ŭ) that don't exist in English. So my problem is that those characters don't display in the game when I type them in localization.txt. They display as question mark (?) and sometimes as blanks. I can use those characters when I type on signs within the game, so I don't think it is a case of the game completely not supporting them. I did wonder if the problem is related to my editing of the file, but it is hard to tell. I am using LibreOffice on Windows 10 to edit the CSV file in a spreadsheet format for easier reading.

Has anyone successfully translated into a language with a different character set? Do you have any tips that you could share?
I really like this game and I would love to get my Esperanto speaking friends to join me, but I am stuck.

Thanks for any assistance.

orlydb
11-20-2018, 06:34 AM
It would be great if we could mark an entry as translated or semi-translated and it is highlighted with a color, so that the next time the program starts and opens the localization file, those entries marked as translated are no longer shown and are filtered and you can better recognize the entries that need to be improved (those marked as semi-translated). This would help because there are quite a few entries and you can " get dizzy " if you see them all and look for a particular one, especially when you do not know very well what they mean by a word and you have to start the game and look for the thing to recognize it and then go back to the program and find the entry to translate it.
Thanks.

- - - Updated - - -


I am trying to create an Esperanto translation for 7 Days To Die and I came across this thread. I found the localization.txt file and used it to create Esperanto versions of the strings.
But now I am stuck with actually trying to get it to work in the game.

1. As mentioned in other parts of this thread, there doesn't appear to be any way to choose other languages for the game. So I just copied my Esperanto text over the English column in the file. While not elegant, it did allow me to change the text in game.

2. My bigger hurdle at the moment is that Esperanto uses a slightly different alphabet than English. It contains a few letters (ĉ, ĝ, ĥ, ĵ, ŭ) that don't exist in English. So my problem is that those characters don't display in the game when I type them in localization.txt. They display as question mark (?) and sometimes as blanks. I can use those characters when I type on signs within the game, so I don't think it is a case of the game completely not supporting them. I did wonder if the problem is related to my editing of the file, but it is hard to tell. I am using LibreOffice on Windows 10 to edit the CSV file in a spreadsheet format for easier reading.

Has anyone successfully translated into a language with a different character set? Do you have any tips that you could share?
I really like this game and I would love to get my Esperanto speaking friends to join me, but I am stuck.

Thanks for any assistance.

You should use the Spanish one and see if the characters are well displayed now.

SandyBeaches
11-29-2018, 03:55 AM
I am writing a python version that automatically trawls through the Localization.txt, and I have found a couple of points:

Source,Context,Changes:- these entries don't appear to ever be used by 7D2D. They are probably for the funpimps internal text editor. Which means we are free to use them!
7D2D uses something called "BetterList" to convert csv files, which has its own special character actions:


Ignore Blank Lines
Ignore lines starting with // to allow comments
Replace """ with """
Replace """ with """


Other than that, it seems to use C# style special characters including \t for tab, so possibly \uHEX will work too e.g. \u2622 = ☢ Radiation symbol


Of these, I suggest we use the third value (Changes), as our modified indicator with the following behaviour:


New entry from a mod/text from user = "modnew"
A later mod overwriting a new entry from a mod/user = still "modnew"
A mod/user overwriting a base entry = "modset" and the original entry inserted after, prefixed by "__base__"


An example of my suggestion in action:
Start with the following lines:
ammoDartSteel,items,Ammo,New,Iron Dart (Ammo),,Eisengeschoss (Mun),,,
ammoDartSteelDesc,items,Ammo,New,Used as ammunition for traps.,,,,,

Mod adds new entry "ammoBook,items,Ammo,New,Book (Ammo),,,,,"
We change 'New' to 'modnew' and append.

ammoDartSteel,items,Ammo,New,Iron Dart (Ammo),,Eisengeschoss (Mun),,,
ammoDartSteelDesc,items,Ammo,New,Used as ammunition for traps.,,,,,
ammoBook,items,Ammo,modnew,Book (Ammo),,,,,


A second mod includes a Localization.txt with a changed description for ammoDartSteel, so we rename the original with the __base__ prefix, and insert the new version:
ammoDartSteel,items,Ammo,New,Iron Dart (Ammo),,Eisengeschoss (Mun),,,
ammoDartSteelDesc,items,Ammo,New,Used as A FUN TOY AM I RIGHT BOYS!?,,,,,
__base__ammoDartSteelDesc,items,Ammo,New,Used as ammunition for traps.,,,,,
ammoBook,items,Ammo,modnew,Book (Ammo),,,,,


This way, when running an automated merger on an already changed Localization.txt, we can effectively restore a clean 'base' Localization dictionary to modify, without having to keep a separate backup somewhere that will get out of date every time there is an official update. Less mucking around, more automation!

CTALKEP
08-11-2019, 12:44 AM
Hi I downloaded this program, but there no source code inside. Could you send the source code or to add search filter in english translation, like in entries on left, and a posiblity to mark read only other translations. Tnx for your super work.

CTALKEP
08-11-2019, 12:52 AM
I am trying to create an Esperanto translation for 7 Days To Die and I came across this thread. I found the localization.txt file and used it to create Esperanto versions of the strings.
But now I am stuck with actually trying to get it to work in the game.


I changed Polish language by setting -language=polish in the Set Launch Options of the game, and it works.

https://i.redd.it/o6hv3j6at0w11.png

-language=german, -language=spanish

I have only problem with Polish fonts and MENU is in English. I recomending to delete one of translations for example french you can do that in excel and delete one column. Next you can start the game as French translation. First row of translation have to be FRENCH, not Esperanto. At the end if all wilbe translated you can ask about to add that into the game.