Kaszanas / SC2InfoExtractorGo

GNU General Public License v3.0
0 stars 2 forks source link

Automatically Loading Map Name Translations #49

Closed Kaszanas closed 22 hours ago

Kaszanas commented 1 year ago

Currently map translation is done by using an external tool to generate a localization JSON.

This could be done differently in a way that sc2reader does this:

Kaszanas commented 9 months ago

This could download all of the maps to a directory, having access to a map should fix the issue of not having the localized map name. The program should also keep track of all of the maps within that directory so as not to re-download them each time.

Additionally, this could be a user-facing flag, if the map localization should be performed then maps must be downloaded to check for their naming (if they don't already exist). Currently the flag used for this is kind of vague and uninformative.

 -localized_maps_file string
        Specifies a path to localization file containing {'ForeignName': 'EnglishName'} of maps. If this flag is not set and the default is unavailable, map translation will be ommited. (default "./operation_files/output.json")

Example logic:

Kaszanas commented 8 months ago

This methods constructs an url to download the map:

https://github.com/ggtracker/sc2reader/blob/c314bfe3081630e96fb8f648cd1a95d560352001/sc2reader/resources.py#L995-L1001

https://github.com/ggtracker/sc2reader/blob/c314bfe3081630e96fb8f648cd1a95d560352001/sc2reader/utils.py#L196-L206

Kaszanas commented 6 months ago

This is implemented on the branch: https://github.com/Kaszanas/SC2InfoExtractorGo/tree/map_downloader

But there are some issues with only using map files as the source of the translated map information.

This tells me that a hybrid approach should be implemented:

  1. DONE: Read all the maps that are downloaded and get hash -> english name mapping.
  2. DONE: Download if the map doesn't exist.
  3. Not possible to download a map? There should be a structure that contains all of the foreign names mapped to english names.

Current implementation should be changed to fit that to reduce errors while processing replays.

Kaszanas commented 22 hours ago

This is implemented in: #58