xforce / eve-echoes-tools

Collection of tools helping in reverse engineering Eve Echoes
MIT License
70 stars 19 forks source link

ZH to EN translations? #6

Closed jmgilman closed 3 years ago

jmgilman commented 3 years ago

Would love some assistance here if anyone has figured this out: how would one translate the zh_name field on all of the items to their English counterpart? My first attempt was looking up the actual string found in zh_name in the respective gettext/zh files, however, I only find results for about half of the total items.

Some of the cases that fail seem to be when the name contains ASCII characters, like this one:

衍生无人机 - LMH-M-1 - B

That string does not exist in the zh files, however, if we do a little reverse engineering we can find that the likely locality id is 14029 which is Metadrones - LMH-M-1 - B in English and 衍生无人机 - 露姆赫-姆-1 - 比 in Chinese. It's not clear to me why in the item file there is ASCII characters but in the locality file, there isn't. I believe I was getting like 29k items in total but only 16k of them could make a direct match back to the Chinese locality data.

Other than reverse looking up like I tried above, it's not clear how one is supposed to tie an item name to its translated name in the locality files. I tried searching around for various locality ID's and most only show up in the locality files and nowhere else. Am I missing data or am I looking at all of this wrong?

xforce commented 3 years ago

Translation is possible using the provided script at https://github.com/xforce/eve-echoes-tools/blob/main/scripts/text_lookup.py

Basically you have to hash the chinese text, then do a a division and index lookup to get to the locale id and lookup the text using that.

Hope that makes it clear how to do it.

jmgilman commented 3 years ago

Should have done more digging! That is very helpful. What's interesting is that even using this method I'm still only getting a little over half of the items. Here is an example that results in a KeyError using your script:

  "44530000009": {
    "base_price": 22160000,
    "can_be_jettisoned": false,
    "icon_id": 44503000000,
    "zh_desc": "$$用于修复损毁的舰船残件。",
    "zh_name": "$$米玛塔尔9级零件"
  },

If you try to lookup the zh_name for that item the hash doesn't exist in the message index.

$ python3 text_convert.py '$$米玛塔尔9级零件' en
Traceback (most recent call last):
  File "text_convert.py", line 18, in <module>
    msg_id = msg_index[str(key)]

Is this normal?

One more example:

"99001000018": {
    "can_be_jettisoned": false,
    "zh_desc": "g85tr",
    "zh_name": "加压蒸汽"
  }
xforce commented 3 years ago

If the index doesn't exists, then the client will also not show a translation in-game, there are a few places where I have seen chinese text in-game. I guess that is just the way it is... There are also a few left over dev/qa items in all the data, I suspect those won't have translations, because why bother. The second example does look like a thing that is not supposed to show in-game anyways, because the description indicating g85tr where g85 is a reference to the internal identifier this game runs as in NetEase.

xforce commented 3 years ago

Anyways, yes. There will be many things that don't have translations, either internal test items for qa, for development, just unfinished things that will be released in the future, or just a missing translation. Either of those could apply.

For now, I would just go with what you get, while possible that I may have missed something, I think that is rather unlikely and will only look further into the translations if/when I find an actual in-game accessible item that can't be translated.

jmgilman commented 3 years ago

No worries, you're way more familiar with the data so I just needed a second set of eyes. Thanks for the help!