Browse Source

Make golint happy. Fixes #21

tags/v1.4.0
Leonel Quinteros 3 years ago
parent
commit
3c52f5c10b
4 changed files with 17 additions and 13 deletions
  1. +14
    -10
      mo.go
  2. +1
    -2
      po.go
  3. +1
    -1
      translation.go
  4. +1
    -0
      translator.go

+ 14
- 10
mo.go View File

@@ -20,11 +20,15 @@ import (
)

const (
MoMagicLittleEndian = 0x950412de // MoMagicLittleEndian encoding
MoMagicBigEndian = 0xde120495 // MoMagicBigEndian encoding

EotSeparator = "\x04" // msgctxt and msgid separator
NulSeparator = "\x00" // msgid and msgstr separator
// MoMagicLittleEndian encoding
MoMagicLittleEndian = 0x950412de
// MoMagicBigEndian encoding
MoMagicBigEndian = 0xde120495

// EotSeparator msgctxt and msgid separator
EotSeparator = "\x04"
// NulSeparator msgid and msgstr separator
NulSeparator = "\x00"
)

/*
@@ -195,8 +199,8 @@ func (mo *Mo) Parse(buf []byte) {
return
// return fmt.Errorf("gettext: %v", err)
}
msgIdData := make([]byte, msgIDLen[i])
if _, err := r.Read(msgIdData); err != nil {
msgIDData := make([]byte, msgIDLen[i])
if _, err := r.Read(msgIDData); err != nil {
return
// return fmt.Errorf("gettext: %v", err)
}
@@ -211,10 +215,10 @@ func (mo *Mo) Parse(buf []byte) {
// return fmt.Errorf("gettext: %v", err)
}

if len(msgIdData) == 0 {
mo.addTranslation(msgIdData, msgStrData)
if len(msgIDData) == 0 {
mo.addTranslation(msgIDData, msgStrData)
} else {
mo.addTranslation(msgIdData, msgStrData)
mo.addTranslation(msgIDData, msgStrData)
}
}



+ 1
- 2
po.go View File

@@ -366,9 +366,8 @@ func (po *Po) pluralForm(n int) int {
/* Use the Germanic plural rule. */
if n == 1 {
return 0
} else {
return 1
}
return 1
}
return po.pluralforms.Eval(uint32(n))
}


+ 1
- 1
translation.go View File

@@ -33,7 +33,7 @@ func (t *Translation) Get() string {
return t.ID
}

// Get returns the string of the plural translation
// GetN returns the string of the plural translation
func (t *Translation) GetN(n int) string {
// Look for Translation index
if _, ok := t.Trs[n]; ok {


+ 1
- 0
translator.go View File

@@ -5,6 +5,7 @@

package gotext

// Translator interface is used by Locale and Po objects
type Translator interface {
ParseFile(f string)
Parse(buf []byte)


Loading…
Cancel
Save