Skip to content

Add yaml translation support to lang files#102

Merged
object-Object merged 6 commits into
hexdoc-dev:mainfrom
Master-Bw3:yaml-translation-support
Jun 14, 2026
Merged

Add yaml translation support to lang files#102
object-Object merged 6 commits into
hexdoc-dev:mainfrom
Master-Bw3:yaml-translation-support

Conversation

@Master-Bw3

Copy link
Copy Markdown
Contributor

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

@Master-Bw3 Master-Bw3 marked this pull request as draft June 12, 2026 01:58
@Master-Bw3 Master-Bw3 force-pushed the yaml-translation-support branch from 6b44228 to 996af9a Compare June 12, 2026 02:00
@Master-Bw3 Master-Bw3 marked this pull request as ready for review June 12, 2026 02:02
@Master-Bw3 Master-Bw3 marked this pull request as draft June 12, 2026 02:04

@object-Object object-Object left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/hexdoc/core/loader.py Outdated
Comment thread src/hexdoc/core/loader.py Outdated
Comment thread src/hexdoc/minecraft/i18n.py Outdated

for resource_dir, lang_id, data in cls._load_lang_resources(loader):
lang = lang_id.path
lang = Path(lang_id.path).stem

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pyproject.toml Outdated
Comment thread src/hexdoc/minecraft/i18n.py Outdated
Comment thread src/hexdoc/core/loader.py
@Master-Bw3 Master-Bw3 marked this pull request as ready for review June 12, 2026 04:13

@object-Object object-Object left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@object-Object object-Object merged commit ede8172 into hexdoc-dev:main Jun 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants