File: goi18n.1

package info (click to toggle)
golang-github-nicksnyder-go-i18n.v2 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 440 kB
  • sloc: xml: 198; sh: 5; makefile: 3
file content (115 lines) | stat: -rw-r--r-- 3,452 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.\"                                      Hey, EMACS: -*- nroff -*-
.\" (C) Copyright 2020 Anthony Fok <foka@debian.org>,
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH GOI18N "1" "2020-10-29" "goi18n (v2)" "goi18n Manual"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh        disable hyphenation
.\" .hy        enable hyphenation
.\" .ad l      left justify
.\" .ad b      justify to both left and right margins
.\" .nf        disable filling
.\" .fi        enable filling
.\" .br        insert line break
.\" .sp <n>    insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.nh
.ad l
.SH NAME
goi18n \- a tool for managing message translations
.SH SYNOPSIS
.B goi18n
.I command
.RI [ arguments ]
.SH DESCRIPTION
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
The \fBgoi18n\fP command manages message files used by the i18n
(github.com/nicksnyder/go-i18n/v2/i18n) Go package.

.SH WORKFLOW
\&
.SS Extracting messages
\&
.TP 4
Use \(lq\fBgoi18n extract\fP\(rq to extract all i18n.Message struct literals in Go source files to a message file for translation.
\&
.EX
# active.en.toml
[PersonCats]
description = "The number of cats a person has"
one = "{{.Name}} has {{.Count}} cat."
other = "{{.Name}} has {{.Count}} cats."
.EE
.nh
\&
.SS Translating a new language
\&
.IP "1." 3
Create an empty message file for the language that you want to add (e.g. \fItranslate.es.toml\fP).
.IP "2." 3
Run \(lq\fBgoi18n merge active.en.toml translate.es.toml\fP\(rq to populate \fItranslate.es.toml\fP with the mesages to be translated.
.IP "" 4
.EX
# translate.es.toml
[PersonCats]
description = "The number of cats a person has"
hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091"
one = "{{.Name}} has {{.Count}} cat."
other = "{{.Name}} has {{.Count}} cats."
.EE
.nh
\&
.IP "3." 3
After \fItranslate.es.toml\fP has been translated, rename it to \fIactive.es.toml\fP.
\&
.IP "" 4
.EX
# active.es.toml
[PersonCats]
description = "The number of cats a person has"
hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091"
one = "{{.Name}} tiene {{.Count}} gato."
other = "{{.Name}} tiene {{.Count}} gatos."
.EE
.nh
\&
.TP
.IP "4." 3
Load \fIactive.es.toml\fP into your bundle.
\&
.IP "" 4
.EX
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
bundle.MustLoadMessageFile("active.es.toml")
.EE
.nh
\&
.SS Translating new messages
\&
.PP
If you have added new messages to your program:
.IP " 1." 4
Run \(lq\fBgoi18n extract\fP\(rq to update \fIactive.en.toml\fP with the new messages.
.IP " 2." 4
Run \(lq\fBgoi18n merge active.*.toml\fP\(rq to generate updated \fItranslate.*.toml\fP files.
.IP " 3." 4
Translate all the messages in the \fItranslate.*.toml\fP files.
.IP " 4." 4
Run \(lq\fBgoi18n merge active.*.toml translate.*.toml\fP\(rq to merge the translated messages into the active message files.
.SH AUTHOR
goi18n is written by Nick Snyder.
.PP
This manual page is prepared for Debian by Anthony Fok using information
from upstream README.md and output of \fBgoi18n \-help\fP.
.SH COPYRIGHT
Copyright \(co 2012\(en2020 Nick Snyder
.br
License: MIT (Expat)
.SH SEE ALSO
Full documentation at \m[blue]\fBhttps://github.com/nicksnyder/go-i18n\fR\m[]