Add i18n function support and centralized data access#95
Open
lenucksi wants to merge 1 commit intojhvanderschee:mainfrom
Open
Add i18n function support and centralized data access#95lenucksi wants to merge 1 commit intojhvanderschee:mainfrom
lenucksi wants to merge 1 commit intojhvanderschee:mainfrom
Conversation
Enable Hugo's native i18n system alongside centralized data configuration
for better translation management and data organization.
- Add support for {{ i18n "key" }} function calls in footerlogo partial
- Enable centralized data access via Site.Data.settings for contact info and titles
- Maintain backward compatibility with language-specific data files
- Add graceful fallbacks for missing translations or centralized data
- Support proper i18n workflows for theme-independent translations
Benefits:
- Hugo native i18n support with {{ i18n }} function calls
- Centralized data management reduces duplication across languages
- Backward compatible - existing language-specific configurations continue working
- Better separation of concerns between translatable and non-translatable content
- Enables proper theme-independent i18n workflows
Usage examples:
i18n/en.yaml:
footer_text:
other: "Copyright © 2024"
data/settings.yaml:
title: "My Site"
contact:
phone: "+1234567890"
email: "hello@example.com"
Template usage:
{{ i18n "footer_text" }} # Uses i18n translations
{{ .Site.Data.settings.title }} # Uses centralized data
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
Benefits
Usage Examples
i18n translations:
Centralized data:
Template usage:
{{ i18n "footer_text" }} // Uses i18n translations {{ .Site.Data.settings.title }} // Uses centralized dataImplementation
Notice:
-> 🤖 Generated with Claude Code