Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
The current state of core options is very translation unfriendly - the only way to add translations is by copying the entire option_defs_us array from libretro_core_options.h to libretro_core_options_intl.h and add each translation into place manually.
There exists no easy way to upload the texts to crowdin and updating the translations is just a pain.
Suggested Solution
In this PR I attempt to rectify this, even though a little naively: by converting the handling of core options into a form similar to how it is done in RetroArch - by utilising hash keys to fetch the actual string via the msg_hash_to_str() function from a msg_hash file corresponding to the current user language. Scripts for converting such msg_hash files into jsons for uploading to crowdin already exist and would need to be modified only slightly for compatibility with core options.
For this I created a Python script ('extract text from options/extract_from_options.py') which extracts the original texts from option_defs_us, creates hash keys for each and even reconstructs option_defs_us to utilise the msg_hash_to_str() function. See 'extract text from options/extract_from_options-instructions.txt' for a more detailed description - keep in mind, though, that those instructions are not yet entirely complete.
Conclusion
As an example, I converted the core options for Flycast and confirmed that it works using the already present Turkish translation (I just copy-pasted part of the translation into msg_hash_flycast_tr.h). I don't know how elegant or robust my implementation is, so I am humbly requesting a review.
The Problem
The current state of core options is very translation unfriendly - the only way to add translations is by copying the entire
option_defs_us
array from libretro_core_options.h to libretro_core_options_intl.h and add each translation into place manually.There exists no easy way to upload the texts to crowdin and updating the translations is just a pain.
Suggested Solution
In this PR I attempt to rectify this, even though a little naively: by converting the handling of core options into a form similar to how it is done in RetroArch - by utilising hash keys to fetch the actual string via the
msg_hash_to_str()
function from a msg_hash file corresponding to the current user language. Scripts for converting such msg_hash files into jsons for uploading to crowdin already exist and would need to be modified only slightly for compatibility with core options.For this I created a Python script ('extract text from options/extract_from_options.py') which extracts the original texts from
option_defs_us
, creates hash keys for each and even reconstructsoption_defs_us
to utilise themsg_hash_to_str()
function. See 'extract text from options/extract_from_options-instructions.txt' for a more detailed description - keep in mind, though, that those instructions are not yet entirely complete.Conclusion
As an example, I converted the core options for Flycast and confirmed that it works using the already present Turkish translation (I just copy-pasted part of the translation into msg_hash_flycast_tr.h). I don't know how elegant or robust my implementation is, so I am humbly requesting a review.