feat(i18n): support per-locale UI string overrides - #40
Open
mathis6787 wants to merge 1 commit into
Open
Conversation
- Added i18nStrings schema definition to support localization. - Updated stardust_schema.dart to include i18nStrings reference. - Enhanced MarkdownParser to utilize localized copy button text and aria-label. - Modified DartdocGenerator to use localized API and back-to-docs labels. - Updated PageLayoutBuilder to reflect localized search placeholder and TOC title. - Enhanced PageScriptsBuilder to include localized runtime strings for copy feedback. - Updated PageBuilder to use localized copy-page Markdown label. - Added tests to ensure proper parsing and application of localized strings.
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.
Summary
Adds per-locale UI string overrides and localizes previously hardcoded Stardust interface text.
Before this change,
i18n.stringswas shared by every locale. Multi-locale sites could not provide different UI strings for each language without client-side JavaScript workarounds.Changes
stringsmap to each locale.i18n.stringsfallback.search.searchingstring during search.Example
Potential follow-up improvements
This PR intentionally preserves
SearchConfig.placeholderandTocConfig.titleto maintain compatibility with existing configurations.In the future, it may be cleaner to move all user-facing defaults—including
"Search docs..."and"On this page"—intoI18nStrings.SearchConfigwould then contain only search behavior, while
TocConfigwould contain onlytable-of-contents behavior.
After centralizing all user-facing defaults in
I18nStrings, a subsequentimprovement could move the built-in translations out of
i18n_config.dartandinto external locale catalogs, for example:
I would be interested in working on these follow-up improvements if this
direction is accepted. I am also open to suggestions !