Hi everyone ! I have some trouble while implement some shortcode for my personal blog
This is notice board (show warning/tip/note/info booard which i’ll call $noticeType from now on) in single.html
The thing is, i tried to translate the $noticeType to my language by using i18n system of hugo. You can see that i created the file call vi.yaml
(Vietnamese)
Example
This is how my shortcode work
{{< notice "tip" >}}
This is **tips**
{{< /notice >}}
vi.yaml
# <project_root>\themes\<my_theme>\i18n\vi.yaml
- id: warning
translation: "Cảnh báo"
- id: note
translation: "Ghi chú"
- id: info
translation: "Thông tin"
- id: tip
translation: "Mẹo"
and set my languageCode in config.toml to vi-VN
config.toml
# config.toml
baseURL = '/'
languageCode = 'vi-VN'
But somehow is not showing up my translated string in the header.
notice.html
<!-- /<project-root>/layouts/shortocdes/notice.html -->
{{ $noticeType := .Get 0 }}
<div class="{{$noticeType}}-container">
<div class="notice-header {{$noticeType }}-header">
<!-- Note/Warning/Info/Tip -->
<span>
<!--This is where i want to show translated-string with i18n -->
{{ i18n $noticeType }}
</span>
</div>
<div class="notice-content {{ $noticeType }}">
<p>{{.Inner | markdownify}}</p>
</div>
</div>
I really need help. Thanks you.