1
// Copyright 2013 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
12
// A MO file is made up of many entries,
13
// each entry holding the relation between an original untranslated string
14
// and its corresponding translation.
16
// See http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
18
MsgContext string // msgctxt context
19
MsgId string // msgid untranslated-string
20
MsgIdPlural string // msgid_plural untranslated-string-plural
21
MsgStr string // msgstr translated-string
22
MsgStrPlural []string // msgstr[0] translated-string-case-0
25
// String returns the po format entry string.
26
func (p Message) String() string {
28
fmt.Fprintf(&buf, "msgid %s", encodePoString(p.MsgId))
29
if p.MsgIdPlural != "" {
30
fmt.Fprintf(&buf, "msgid_plural %s", encodePoString(p.MsgIdPlural))
33
fmt.Fprintf(&buf, "msgstr %s", encodePoString(p.MsgStr))
35
for i := 0; i < len(p.MsgStrPlural); i++ {
36
fmt.Fprintf(&buf, "msgstr[%d] %s", i, encodePoString(p.MsgStrPlural[i]))