File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,27 @@ Use tl and ctl for translating singular texts and tn and ctn for plural forms.
6161
6262` ` ` html
6363<!-- Singular -->
64- <p>{{ tl " Hello, World!" }}</p>
64+ <p>{{ tl . Loc " Hello, World!" }}</p>
6565
6666<!-- Plural -->
67- <p>{{ tn " You have one message." " You have %d messages." 5 , 5 }}</p>
67+ <p>{{ tn . Loc " You have one message." " You have %d messages." 5 , 5 }}</p>
6868` ` `
69+
70+ Localizer interface
71+ --
72+
73+ The Localizer interface is used to provide the translator with the current language.
74+ It is used to determine the correct translation for the given key.
75+
76+ ` ` ` go
77+ // Localizer interface contains the methods that are needed for the translator
78+ Localizer interface {
79+ // GetLocale returns the locale of the localizer, ie. "en_US"
80+ GetLocale () string
81+ }
82+ ` ` `
83+
84+
6985Adding a New Language
7086--
7187` ` ` go
You can’t perform that action at this time.
0 commit comments