Add yaml translation support to lang files#102
Conversation
6b44228 to
996af9a
Compare
object-Object
left a comment
There was a problem hiding this comment.
Thanks for the contribution (and for putting up with the sorry state of hexdoc's build system)! Most of this looks good, but I left some nits, and there might be an unintended difference in functionality that would need fixing.
|
|
||
| for resource_dir, lang_id, data in cls._load_lang_resources(loader): | ||
| lang = lang_id.path | ||
| lang = Path(lang_id.path).stem |
There was a problem hiding this comment.
Why is this change necessary?
There was a problem hiding this comment.
a lot of the functions automatically strip out json. it seemed like it would have gotten messy to add logic everywhere to strip out yml too, so I just have this remove the suffix if it exists from the lang file name to get just the language code
There was a problem hiding this comment.
update: I changed find_resources to take a strip_suffix parameter instead of automatically stripping it off of .json files, The tests pass but I'm not sure if it would mess up other assets outside lang/patchi entries. should I also keep the logic to strip the suffix off all .json files?
There was a problem hiding this comment.
update 2: I'm just having it automatically strip the suffixes off of all json and yaml files now. it already did that for json and it works to do it for yaml too
Allows translation files written in yaml to be used. translation files end in the .yml extension.
This makes hexdoc compatible with https://github.com/Fallen-Breath/yamlang