feat: add better localization support#71
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis PR restructures the module to add Project Fluent-based internationalization support, moving the render function to src/index.js and introducing locale file loading, template variable replacement for UI strings, and resume schema upgrade logic while adding @fluent/bundle and @fluent/langneg dependencies. Changes
Sequence DiagramsequenceDiagram
participant Caller
participant render as render(resume)
participant FileIO as FileSystem
participant Upgrade as upgradeOutdatedResume
participant Messages as Messages
participant Handlebars as Handlebars
participant Minify as HTML Minifier
Caller->>render: resume object
render->>FileIO: read style.css & resume.handlebars
FileIO-->>render: template & styles
render->>Upgrade: upgrade resume schema
Upgrade-->>render: upgraded resume (if needed)
render->>Messages: new Messages().load(locale)
Messages->>FileIO: read locale file
FileIO-->>Messages: locale bundle
Messages-->>render: messages instance
render->>Handlebars: compile template<br/>(with helpers: markdown, link, i18n, date)
Handlebars->>Handlebars: render with resume data<br/>(helpers localize & format)
Handlebars-->>render: rendered HTML
render->>Minify: minify HTML
Minify-->>render: minified result
render-->>Caller: HTML string
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes The changes introduce substantial new logic: Fluent-based i18n infrastructure with language negotiation, resume schema upgrade with multiple field mutations, Handlebars helpers with markdown parsing and locale-aware formatting, and file I/O coordination. The modifications span multiple architectural layers (module structure, dependencies, template compilation) and require careful validation of schema upgrade logic, i18n message loading, and helper behavior. Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
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 |
Adds real localization support. Up until now, we only used
meta.languageto set thelangattribute in the metadata of the document.Now we'll actually use it to change how we format dates, and will slowly add languages to change how the actual sections/titles are rendered.
Currently, only English is fully supported, but we'll get Dutch fairly quickly, and likely get German, French, Bosnian, Norwegian, etc., in the near future.
A lot of the i18n code is actually just taken from gitlab.com/SethFalco/matrix-stream-alerts.
Chore
Also restructures the project so it's all maintained in a
src/directory, and we expose therenderfunction in the rootindex.jsfile the same way we did before. This will keep the project simple to maintain as we scale up the feature set, but maintain compatibility withresume-cli.Related
Summary by CodeRabbit