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.
6
Package mo provides support for reading and writing GNU MO file.
10
"github.com/chai2010/gettext-go/gettext/mo"
14
moFile, err := mo.Load("test.mo")
18
fmt.Printf("%v", moFile)
24
+------------------------------------------+
25
0 | magic number = 0x950412de |
27
4 | file format revision = 0 |
29
8 | number of strings | == N
31
12 | offset of table with original strings | == O
33
16 | offset of table with translation strings | == T
35
20 | size of hashing table | == S
37
24 | offset of hashing table | == H
40
. (possibly more entries later) .
43
O | length & offset 0th string ----------------.
44
O + 8 | length & offset 1st string ------------------.
46
O + ((N-1)*8)| length & offset (N-1)th string | | |
48
T | length & offset 0th translation ---------------.
49
T + 8 | length & offset 1st translation -----------------.
51
T + ((N-1)*8)| length & offset (N-1)th translation | | | | |
53
H | start hash table | | | | |
55
H + S * 4 | end hash table | | | | |
57
| NUL terminated 0th string <----------------' | | |
59
| NUL terminated 1st string <------------------' | |
63
| NUL terminated 0th translation <---------------' |
65
| NUL terminated 1st translation <-----------------'
69
+------------------------------------------+
71
The GNU MO file specification is at
72
http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html.