Fix custom system-messages not applied to auto-generated nav buttons#267
Open
Hergie wants to merge 1 commit intosurveydown-dev:mainfrom
Open
Fix custom system-messages not applied to auto-generated nav buttons#267Hergie wants to merge 1 commit intosurveydown-dev:mainfrom
Hergie wants to merge 1 commit intosurveydown-dev:mainfrom
Conversation
Two bugs in R/config.R: 1. extract_html_pages() read settings_yaml$system_messages (underscore) but the YAML key is system-messages (hyphen), so custom nav button labels were silently ignored. Fixed by using backtick-quoted `system-messages`. 2. survey_files_need_updating() did not check whether settings.yml is newer than pages.rds, so changes to system-messages required manually deleting pages.rds. Added settings.yml to the staleness check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
I did not manage to set a custom label for automatically generated next buttons (I wanted to translate these into Finnish). Claude's solution below.
Summary
Bug 1:
extract_html_pages()readssettings_yaml$system_messages(underscore) but the YAML key issystem-messages(hyphen). This causes custom message overrides (e.g., translating "Next" to another language) to be silently ignored for
auto-generated navigation buttons. Fixed by using backtick-quoted
`system-messages`.Bug 2:
survey_files_need_updating()does not check whether_survey/settings.ymlis newer thanpages.rds. Sincecreate_settings_yaml()runs insd_ui()and may updatesettings.yml(e.g., whensystem-messagesare added to the YAML header),pages.rdsmust be regenerated to pick up the new button labels. Without this check, users must manually deletepages.rdsto see updated nav button text.Reproduction
system-messages:block as a top-level YAML key insurvey.qmdwith e.g.next: "Seuraava"shiny::runApp()Solution
Two changes in
R/config.R:settings_yaml$system_messagestosettings_yaml$´system-messages´soextract_html_pages()correctly reads the kebab-case YAML key.
settings.ymltimestamp to the staleness check insurvey_files_need_updating(), sopages.rdsisregenerated when settings change.
Verified locally: after applying the fix, custom
nextlabels appear correctly on auto-generated navigation buttons.