Hugo: Add .Site.I18n method

Created on 16 Oct 2020  Â·  4Comments  Â·  Source: gohugoio/hugo

Following the support question in this forum thread: it would be nice to have site.Translation method to leverage i18n information from the .Translations range.

Enhancement

Most helpful comment

I'm not totally sure about the method name. Since it should behave the same as the current i18n func, maybe we should just name it site.I18n so people don't get other expectations.

All 4 comments

I'm not totally sure about the method name. Since it should behave the same as the current i18n func, maybe we should just name it site.I18n so people don't get other expectations.

Without a capitalized "I", I'd suggest: site.i18n.

.site.i18n with an alias of .site.T — for full consistency, you know...

Without a capitalized "I", I'd suggest: site.i18n.

  • As this would be a method on the Site interface, the Go spec forces first character to be uppercase for public/exported methods.
  • site.i18n is technically a function and could be all lowercase (I think), but that is just an alias for .Site.I18n, which is the useful method in this setting, as in: .Sites.First.I18n "foo"

And also, I don't want to fill the Site interface up with aliases.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arikroc picture arikroc  Â·  3Comments

geddski picture geddski  Â·  3Comments

VoidingWarranties picture VoidingWarranties  Â·  3Comments

tjamet picture tjamet  Â·  3Comments

sigma picture sigma  Â·  3Comments