besteon / Ironmon-Tracker

A Lua script for the Bizhawk/mGBA emulator compatible with Pokemon Fire Red, Leaf Green, Ruby, Sapphire, and Emerald that tracks relevant data for the IronMon challenge.
MIT License
122 stars 44 forks source link

Better Multi-Language Support #390

Closed UTDZac closed 1 year ago

UTDZac commented 1 year ago

This PR offers a way for the Tracker to become fully translated in languages other than English. To accomplish this, anywhere and everywhere that text appears on the Tracker has been "extracted" and moved to a resource file for it's corresponding language.

The ultimate goal of this project is to get help from the community to translate the Tracker into different languages. This will be accomplished through a GitHub Discussion forum.

This PR is massive beyond reason and I don't expect a full review of everything. I would like some extra eyes on some of the larger-scale changes.

Features

Primary Files to Focus Review

Questions

Notes & Known Issues

image

Fellshadow commented 1 year ago

Also mentioning #62 as this is related and that issue is sorta our main "non-english support" update/progress log

UTDZac commented 1 year ago

Fixed the ability to search for names of things containing accented characters in https://github.com/besteon/Ironmon-Tracker/pull/390/commits/6f81cd6968a80c402a611ac4a95901930b8f3549 , using the keyboard that only has plain text characters. This required a good bit of reorganization work to get it done, partly why I avoided it in the first place, but had the energy today to get it resolved.

One lingering issue that was present before and after this change is that on Bizhawk 2.8, for names of things that start with special characters, they don't seem to render properly... and I'm not entirely sure why.

image

ÜBERWURF (Vital Throw) is not displayed correctly.

Fellshadow commented 1 year ago

Fixed the ability to search for names of things containing accented characters in 6f81cd6 , using the keyboard that only has plain text characters. This required a good bit of reorganization work to get it done, partly why I avoided it in the first place, but had the energy today to get it resolved.

One lingering issue that was present before and after this change is that on Bizhawk 2.8, for names of things that start with special characters, they don't seem to render properly... and I'm not entirely sure why.

image

ÜBERWURF (Vital Throw) is not displayed correctly.

@UTDZac Had a little dig on my bizhawk 2.8 install, seems it's coming from the RandomizerLog.setupMappings somehow failing to properly format the move name as lowercase (resulting in a failed move to id mapping later), which is weird because the same toLowerUTF8 and formatSpecialCharacters Utils functions work fine when parsing the log?

Attaching some Console output below, the umlaut characters print to the console weird but as you can see they get formatted fine in the end. Although this then makes me wonder if it's down to a difference in character encoding between our own files being read by RandomizerLog.setupMappings and the log file being read by e.g. RandomizerLog.parseLog and it just didn't affect the other characters because they happened to be lowercase to begin with, though that would be weird considering we have the characters defined the same way in Constants.Chars 🤔 image image

UTDZac commented 1 year ago

Fixed the Bizhawk 2.8 encoding issue in https://github.com/besteon/Ironmon-Tracker/pull/390/commits/4f892875c3e0ba3705e66c620f43726da22860bb by just adding duplicate entries to Constants.Char for each of the special characters that require encoding.

For example, instead of just one entry for ý there are now two:

    ["ý"] = {
        encoded = "\253",
        upper = "Ý",
        plain = "y",
        width = 3,
    },
    ["\253"] = {
        upper = "\221",
        plain = "y",
        width = 3,
    },
UTDZac commented 1 year ago

https://github.com/besteon/Ironmon-Tracker/pull/390/commits/2aee88c1b1a46029596afe9b7d1366a04a5fe888 Fixed the issue where the log couldnt be parsed if the Tracker's display language didnt match.

UTDZac commented 1 year ago

With all that said, I'm ready to merge this in. Just wanting to see if you have any final thoughts.