The value from the i18n file should be something like the default value of the variable $action. In the case the parameter action exists, the default value should be overridden.
Unfortunately $action always contains the value from the i18n file. How can I change this?
Let’s say you want to colorize the link of the page you’re watching. Therefore you need to range through all pages of your project and list all page titles. This you would do like so:
{{ range .Site.Pages }}
{{ .Title }}
{{ end }}
Now if you want to highlight the link you’re on you need something to compare with. And here the scope comes into play.
In the above example the scope is the title of the iterated page inside the range.
Now check this:
<!-- This is the title of the page I'm currently viewing -->
{{ $title := .Title }}
<!-- In here the title is the title of the iterated page -->
{{ range .Site.Pages }}
<li><a href="{{.URL}}" style="{{ if eq $title .Title }}background-color: green;{{ end }}">{{ .Title }}</a></li>
{{ end }}
The function range is now comparing the title the viewer is seeing with the title of the iterated page. If they are the same, the background will be highlighted.
So the scope of the variable $title is the title of the page the viewer is seeing. The scope of .Title is the page which is just iterated range.
I think this is very well documented in the Hugo Docs.