Skip to content

Commit 7168ba1

Browse files
committed
mention interface
1 parent cd88990 commit 7168ba1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
6985
Adding a New Language
7086
--
7187
```go

0 commit comments

Comments
 (0)