Update commits

Signed-off-by: Josef Fröhle <froehle@b1-systems.de>
This commit is contained in:
2018-03-26 20:47:41 +02:00
committed by Josef Fröhle
parent cd46239477
commit 4172a9c4a7
8 changed files with 57 additions and 57 deletions

View File

@@ -5,12 +5,14 @@
package gotext
// Translation is the struct for the Translations parsed via Po or Mo files and all coming parsers
type Translation struct {
ID string
PluralID string
Trs map[int]string
}
// NewTranslation returns the Translation object and initialized it.
func NewTranslation() *Translation {
tr := new(Translation)
tr.Trs = make(map[int]string)
@@ -18,6 +20,7 @@ func NewTranslation() *Translation {
return tr
}
// Get returns the string of the translation
func (t *Translation) Get() string {
// Look for Translation index 0
if _, ok := t.Trs[0]; ok {
@@ -30,6 +33,7 @@ func (t *Translation) Get() string {
return t.ID
}
// Get returns the string of the plural translation
func (t *Translation) GetN(n int) string {
// Look for Translation index
if _, ok := t.Trs[n]; ok {