-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hugo doesn't properly use localisation keys #49649
Comments
That wasn't a side effect of #43211; it's more that Windows' symlink support is a bit basic. |
My idea: provide a PowerShell script that does roughly the same thing as the |
We should also revert #43211 |
/triage accepted |
Symlinks can be automatically handled in Windows by setting the proper git config parameter so I don't think we need a script, rather we can call it out in contributing docs. Before we revert #43211, I tried to see what would happen and created the darft PR #49643 to test the netlify build outcome of such a revert. See https://deploy-preview-49643--kubernetes-io-main-staging.netlify.app/
|
Problem:
Right now localisation keys are not working as expected. This can be seen when attempting to override localisation keys from Docsy. Overriding just doesn't work.
For eg. if I add a key such as
[ui_search]
in/data/i18n/en/en.toml
, it's value is never overriden. It's the value set by Docsy that's shown.Proposed Solution:
This issue is due to the presence of
i18nDir
property inhugo.toml
. This property forces Hugo to look for translation keys directly in the/data/i18n/en/en.toml
andi18n/en/en.toml
is completely ignored. This change was made in #43211 which attempted to fix local previewing in Windows as POSIX symlinks were not working at that time. This caused all files ini18n/<language>
to not be symlinks, rather contain the relative path to the symlink as text. This is invalid TOML and just removingi18nDir
inhugo.toml
will once more break Windows local previewing.But this property is causing overall issues and needs to be removed anyway.
Handling symlinks in Windows
Git can create Windows symlinks when configured properly. See https://github.com/git-for-windows/git/wiki/Symbolic-Links and https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows. In short, one needs to:
mklink
permissionsSystem setting: check the checkbox when installing msysgit
Global setting:
git config --global core.symlinks true
Local setting:
git config core.symlinks true
And not overridden by a lower level config set to false.
Also note, that if you already have a repo checked out, you will need to set the config locally too and switch branches back and forth to get git to realise the change.
See google/docsy#2187 for an earlier issue that was raised and might contain more details.
The text was updated successfully, but these errors were encountered: