Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,31 @@ Described at [documentation](https://github.com/stradichenko/PKB-theme/blob/main

### [Color Theme Customization](https://stradichenko.github.io/PKB-theme/docs/color-theme-customization)

### Internationalization (i18n)

The theme uses Hugo's built-in [i18n](https://gohugo.io/content-management/multilingual/) system so that template strings can be translated. All user-facing strings live in `i18n/en.toml` at the theme root, and templates reference them via `{{ T "key" }}`.

To add a translation:

1. Copy `i18n/en.toml` to `i18n/<lang>.toml` (e.g. `i18n/es.toml` for Spanish) and translate the values, leaving the keys unchanged.
2. Register the new language in `config/_default/hugo.toml` under the `[languages]` block:

```toml
[languages]
[languages.en]
languageName = "English"
languageCode = "en-US"
weight = 1
[languages.es]
languageName = "Español"
languageCode = "es-ES"
weight = 2
```

3. Optionally, override individual strings from your own site by creating an `i18n/<lang>.toml` file in your project root — Hugo's lookup order will prefer your project's translations over the theme's defaults.

See [Hugo's multilingual documentation](https://gohugo.io/content-management/multilingual/) for full details on translating content, menus, and dates.


## FAQ
### Hugo's Theme Configuration Inheritance (Lookup Order)
Expand Down
11 changes: 10 additions & 1 deletion config/_default/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'HUGO_site'

defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false

enableGitInfo = true
#relativeURLs = true
#canonifyURLs = true
Expand Down Expand Up @@ -518,4 +521,10 @@ enableGitInfo = true
filename = 'sitemap.xml'
priority = -1

uglyURLs = false
uglyURLs = false

[languages]
[languages.en]
languageName = "English"
languageCode = "en-US"
weight = 1
103 changes: 103 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Common
SiteTitle = "PKB Theme"
ReadMore = "Read more"
BackToTop = "Back to top"

# Single post
Created = "Created"
Updated = "Updated"
TableOfContents = "Table of Contents"
Author = "Author"
Tags = "Tags"
Categories = "Categories"
References = "References"
Footnotes = "Footnotes"
Citations = "Citations"

# Search
Search = "Search"
SearchPlaceholder = "Search…"
SearchNoResults = "No results"
SearchResultsFor = "Results for"

# Theme toggle
ToggleTheme = "Toggle theme"
ThemeLight = "Light"
ThemeDark = "Dark"

# Share
Share = "Share"
ShareModalTitle = "Share this page"
CopyLink = "Copy link"
LinkCopied = "Link copied!"

# QR
QRCode = "QR code"
QRCodeFor = "QR code for"

# About page
NoSocialLinks = "No social links available."
NoInterests = "No interests listed."
Interests = "Interests"

# PDF
GeneratePDF = "Generate PDF"
PrintToPDF = "Print to PDF"

# TTS
ListenToPage = "Listen to this page"
TTSSystemVoice = "System Voice"
TTSBrowserBuiltin = "Browser built-in"
TTSNeuralHD = "Neural HD"
TTSOnetimeDownload = "One-time download · cached locally"
TTSPlay = "Play"
TTSPause = "Pause"
TTSStop = "Stop"

# Knowledge graph
KGPhysicsControls = "Physics Controls"
KGRepulsion = "Repulsion"
KGResetToDefault = "Reset to Default"
KGAllNodes = "All Nodes"
KGSaveAsPNG = "Save as PNG"
KGSaveAsSVG = "Save as SVG"
KGSaveAsJPEG = "Save as JPEG"
KGFullscreen = "Fullscreen"

# Activity calendar
ActivityCalendar = "Activity Calendar"
CalendarLess = "Less"
CalendarMore = "More"
CalendarContributions = "contributions"
CalendarNoActivity = "No activity"

# Zipf's law / LDA
ZipfTitle = "Zipf's Law"
ZipfWord = "Word"
ZipfFrequency = "Frequency"
ZipfRank = "Rank"
LDATopics = "Topics"
LDADocument = "Document"
LDATopicNumber = "Topic"

# Filters
FilterByTag = "Filter by tag"
FilterByCategory = "Filter by category"
FilterClear = "Clear filters"
FilterAll = "All"

# 404 page
NotFoundTitle = "404 — Page Not Found"
NotFoundMessage = "The page you are looking for could not be found."
NotFoundReturnHome = "Return home"

# Comments
CommentsLoading = "Loading comments…"
CommentsDisabled = "Comments are disabled."

# Misc
PoweredBy = "Powered by"
GeneratedBy = "Generated by"
LoadingMore = "Loading more…"
Error = "Error"
AnchorLabel = "Permalink to this section"