feat(i18n): open translation system to third-party paks - #1
Open
dalexanco wants to merge 5 commits into
Open
Conversation
Documents I18N_load_extra() for compiled paks and the planned i18n.elf CLI for shell paks, mirroring the nextval.elf / pak-hooks.sh precedents already in the codebase. Implementation follows separately.
…anslation packs - i18n.elf format: %s-only positional substitution, never handed to printf(1) directly, so a third-party-translated .lang value can't become a format-string footgun. - Document a pak-i18n-common pattern: a shared .userdata/shared/i18n-community/<Pak>/<code>.lang path, merged via an extra -f, that lets a data-only pak translate someone else's pak without touching its code -- conditional on that pak already routing strings through T()/i18n.elf.
Exposes the existing parse_file() as a public, append-only entry point: a pak (compiled, or i18n.elf on a shell pak's behalf) can merge its own .lang file into the table already loaded by I18N_init()/I18N_reload() without clearing the OS's own entries. No-op before I18N_init(); safe to call repeatedly, later files win on key collisions. Step 1 of I18N.md's pak-scoped i18n plan.
Cut repeated framing/rationale, keep the same technical content and examples. 269 -> 179 lines.
New workspace/all/i18n_cli/, built and packaged like nextval.elf: i18n.elf lang prints active language code i18n.elf get <key> [-f <path>]... resolves a key, T() fallback semantics i18n.elf format <key> [-f <path>]... -- args %s-only positional interpolation -f is repeatable (I18N_load_extra() per file, later wins) -- this is what lets a shell pak merge its own res/lang/ file, and optionally a second community-translation file on top, in one call. format never hands the resolved template to printf(3)/vprintf: only %s is recognized and substituted, any other specifier (%d, %u, %n...) is left as literal text. A .lang value -- including a third-party or community-contributed one -- can never control how many bytes get written. Wired into workspace/makefile (all + clean) and the root makefile's system: target, same placement as nextval.elf. Step 2 of I18N.md's pak-scoped i18n plan.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the i18n system from LoveRetro#735 to third-party Tools paks, without touching NextUI's own .lang files or core translation flow.
Full design and conventions documented in I18N.md.