Skip to content

I18n data#230

Merged
JayPanoz merged 15 commits intodevelopfrom
i18n-data
May 4, 2026
Merged

I18n data#230
JayPanoz merged 15 commits intodevelopfrom
i18n-data

Conversation

@JayPanoz
Copy link
Copy Markdown
Collaborator

This creates a JSON file for language-specific values in ReadiumCSS-base module so that they can be accessible to external consumers of ReadiumCSS.

A use case would be to adjust the value you submit for line height to the Preferences API in Navigators depending on the language, or adjust font-family putting the value in the selection as sort of a default value.

@mickael-menu
Copy link
Copy Markdown
Member

What would be the strategy for a RS to figure out which line height compensation to use? Here's an attempt:

  • Find the key with match the publication's full BCP-47 language + region code.
  • If no match, find the key after removing the region code (only BCP-47 language code).
  • If no match, use default (or ignore, because the line height compensation should be 1).

@JayPanoz
Copy link
Copy Markdown
Collaborator Author

Yeah that makes sense as I treated it like this lately as it was the most obvious way to do it.

We'd better document it for clarity. I am also thinking about the case where Latin may not be the default script of the app, in which case we should warn to not blindly apply this logic.

Abstract the rule for app/publication instead of treating non-latin-based apps as outliers.
Comment thread css/vars/CSS-Variables.md Outdated
@JayPanoz JayPanoz marked this pull request as ready for review May 4, 2026 12:24
@JayPanoz JayPanoz requested a review from Copilot May 4, 2026 12:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Exposes more ReadiumCSS variable data as published JSON/docs for external consumers, especially language-specific font-family and line-height defaults, and wires the build to generate a Markdown reference from those datasets.

Changes:

  • Added new published variable datasets (i18n.json, settings.json) and converted existing exported vars JSON files to unprefixed keys, with PostCSS now adding the --RS__ prefix at build time.
  • Updated the base stylesheet and regenerated compiled CSS so language-specific defaults come from imported i18n data instead of hardcoded values.
  • Added generated/reference documentation for the new data, updated EPUB/migration docs, and bumped the package version/build pipeline.

Reviewed changes

Copilot reviewed 15 out of 30 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
scripts/generate-vars-doc.js New script to build css/vars/CSS-Variables.md from exported JSON data.
package.json Adds vars-doc generation to the build and bumps package version.
docs/ReadiumCSS_docs/OEBPS/toc.ncx Adds EPUB TOC entry for the new i18n migration note.
docs/ReadiumCSS_docs/OEBPS/Text/Section-028.xhtml Adds EPUB migration-guide content about exposed i18n data.
docs/ReadiumCSS_docs/OEBPS/Text/nav.xhtml Adds EPUB nav link for the new section.
docs/ReadiumCSS_docs/OEBPS/content.opf Updates EPUB modified timestamp metadata.
docs/CSS28-migration_guide.md Adds migration-guide section about i18n stacks and generated vars docs.
css/vars/settings.json New published mapping of stylesheet variants to disabled/added user settings.
css/vars/pagination.json Publishes pagination defaults with unprefixed JSON keys.
css/vars/i18n.json New published language-to-font/line-height mapping.
css/vars/fontStacks.json Publishes default/Japanese font stacks with unprefixed JSON keys.
css/vars/CSS-Variables.md Generated reference document for exported CSS variable data.
css/vars/colors.json Publishes color defaults with unprefixed JSON keys.
css/src/modules/ReadiumCSS-base.css Switches base language defaults to imported i18n variables.
css/postcss.config.js Configures JSON import plugin to prepend --RS__.
css/dist/webPub/ReadiumCSS-webPub.css Regenerated webPub bundle header/version.
css/dist/rtl/ReadiumCSS-default.css Regenerated RTL default bundle header/version.
css/dist/rtl/ReadiumCSS-before.css Regenerated compiled RTL base bundle with imported i18n vars.
css/dist/rtl/ReadiumCSS-after.css Regenerated RTL after bundle header/version.
css/dist/ReadMe.md Updates published dist README content.
css/dist/ReadiumCSS-default.css Regenerated default bundle header/version.
css/dist/ReadiumCSS-before.css Regenerated compiled base bundle with imported i18n vars.
css/dist/ReadiumCSS-after.css Regenerated after bundle header/version.
css/dist/cjk-vertical/ReadiumCSS-default.css Regenerated CJK vertical default bundle header/version.
css/dist/cjk-vertical/ReadiumCSS-before.css Regenerated compiled CJK vertical base bundle with imported i18n vars.
css/dist/cjk-vertical/ReadiumCSS-after.css Regenerated CJK vertical after bundle header/version.
css/dist/cjk-horizontal/ReadiumCSS-default.css Regenerated CJK horizontal default bundle header/version.
css/dist/cjk-horizontal/ReadiumCSS-before.css Regenerated compiled CJK horizontal base bundle with imported i18n vars.
css/dist/cjk-horizontal/ReadiumCSS-after.css Regenerated CJK horizontal after bundle header/version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread css/vars/colors.json
Comment thread css/vars/pagination.json
Comment thread css/vars/fontStacks.json
Comment thread css/vars/i18n.json
Comment thread css/vars/i18n.json Outdated
Comment thread docs/CSS28-migration_guide.md Outdated
Comment thread docs/ReadiumCSS_docs/OEBPS/Text/Section-028.xhtml Outdated
Comment thread docs/CSS28-migration_guide.md
Comment thread css/src/modules/ReadiumCSS-base.css
Comment thread package.json
@JayPanoz JayPanoz merged commit e384936 into develop May 4, 2026
1 check passed
@JayPanoz JayPanoz deleted the i18n-data branch May 4, 2026 13:12
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.

3 participants