CONTEXT
My website is composed by 200 pages for each 3 languages, therefore 600 pages. To have exactly the same architecture between the 3 languages, I have no language text written in my layout but traduction ID only. And in my layouts and partial, I call (T .Params.). When I want to change contents (ex: change “_” to “-” in the slug chain), I don’t have to enter 600 times in each .md of each language. I only modify it very quickly my Excel files (with filters and research/replace options) where I have all my translations ID and the value for each languages. Then I export the CSV to the .toml format to fit and copy past it in the language files en.toml. It works perfectly in 95 % of case.
EXAMPLE WHICH WORKS
For instance, it perfectly works for Title. In the front matter of each of my pages, I put the ID I have created in the Excel file, as for instance Title: PAGE_NAME_TITLE. And in the baseof.html file, I call the translation of the parameter ‘Title’ :
<title>
{{ block "title" . }}
{{ with (T .Params.Title) }}
{{ . }}
{{ end }}
{{ end }}
</title>
QUESTION FOR THE SLUG PARAMETER
My need is to do the same with the parameter Slug. How and where can I configurate (T .Params.slug) to call the traduction ID in the front matter ?
Question to people who manage multilanguage websites.
How do you configure the slug ? Do you really writte it directely in the front matter of each of hundred of pages or do you have any tip to systemise the integration ?
If I need to do a mass edit, I use regex and use my editor’s search-and-replace feature. The editor will search all files in a certain folder and will replace all instances it finds even in closed files. You can do this in SublimeText and in VScode/VScodium.
I use this website regex101 to build and test my regex before I use it for mass search-and-replace. For VScode/VScodium, it uses JavaScript for its regex engine while SublimeText uses PCRE.
Here’s a sample regex, I recently had to change 「」 to 《》.
Another example, I recently started using linters and did not notice I made a mess of some URLs. Instead of reverting my repo back to before I started to use linters, I used regex to quickly do a mass fix.
In my case, I would like to personalise it for each language to enable a full experience for someone who speaks only the current language. Here an example for the homepage.
Ahh, that’s the setup I have in a site I scrapped.
To keep the translations working, you need: translationKey = ""
Set it the same for content translations so Hugo can see which is a translation of another content. Although I think you already have that frontmatter setting?