unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
blob 0d0c7c1f38ababc6f4d8e007ed1ebabe94d9e31a 3213 bytes (raw)
name: website/i18n-howto.txt 	 # note: path name is non-authoritative(*)

 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
 
With sexp-xgettext, arbitrary s-expressions can be marked for
translation (not only strings like with normal xgettext).

S-expressions can be marked with G_ (simple marking for translation),
N_ (“complex” marking with different forms depending on number like
ngettext), C_ (“complex” marking distinguished from other markings by
a msgctxt like pgettext) or NC_ (mix of both).

Marking a string for translation behaves like normal gettext.  Marking
a parenthesized expression (i.e. a list or procedure call) extracts
each string from the parenthesized expression.  If a symbol, keyword
or other parenthesized expression occurs between the strings, it is
extracted as an XML element.  Expressions before or after all strings
are not extracted.  If strings from a parenthesized sub-expression
shall be extracted too, the sub-expression must again be marked with
G_ unless it is the only sub-expression or it follows a quote,
unquote, quasiquote or unquote-splicing.  The order of XML elements
can be changed in the translation to produce a different ordering
inside a parenthesized expression.  If a string shall not be extracted
from a marked expression, it must be wrapped, for example by a call to
the identity procedure.  Be careful when marking non-SHTML content
such as procedure calls for translation: Additional strings will be
inserted between non-string elements.

Known issues:

* Line numbers are sometimes off.

* Some less important other TODOs in the comments.

=====

The following commands are an example of the translation for locale
de_DE.  Adapt as necessary.  We assume the software requirements
mentioned in the README are installed.

To create a pot file:

guile scripts/sexp-xgettext.scm -f po/POTFILES \
                                -o po/guix-website.pot \
                                --from-code=UTF-8 \
                                --copyright-holder="Ludovic Courtès" \
                                --package-name="guix-website" \
                                --msgid-bugs-address="ludo@gnu.org" \
                                --keyword=G_ \
                                --keyword=N_:1,2 \
                                --keyword=C_:1c,2 \
                                --keyword=NC_:1c,2,3

To create a po file from a pot file, do the usual:

cd po
msginit -l de --no-translator

To merge an existing po file with a new pot file:

cd po
msgmerge -U de.po guix-website.pot

To update mo files:

mkdir -p de/LC_MESSAGES
cd po
msgfmt de.po
cd ..
mv po/messages.mo de/LC_MESSAGES/guix-website.mo

To build all languages:

guix build -f .guix.scm

To test the de_DE translation:

guix environment --ad-hoc haunt
LC_ALL=de_DE.utf8 \
 GUILE_LOAD_PATH=$(guix build guile-syntax-highlight)/share/guile/site/2.2:$GUILE_LOAD_PATH \
 GUIX_WEB_SITE_LOCAL=yes \
 haunt build
GUILE_LOAD_PATH=$(guix build guile-syntax-highlight)/share/guile/site/2.2:$GUILE_LOAD_PATH \
 haunt serve

For checking for errors / debugging newly marked files you can try:

GUILE_LOAD_PATH=.:$(guix build haunt)/share/guile/site/2.2:\
$(guix build guile-syntax-highlight)/share/guile/site/2.2:$GUILE_LOAD_PATH \
 guile apps/base/templates/about.scm   # an example for debugging about.scm

debug log:

solving 0d0c7c1 ...
found 0d0c7c1 in https://yhetil.org/guix-bugs/20190915201819.3yxm25fayvbxwdpl@pelzflorian.localdomain/ ||
	https://yhetil.org/guix-bugs/20190906142548.4crfjgvxilgalgrs@pelzflorian.localdomain/

applying [1/1] https://yhetil.org/guix-bugs/20190915201819.3yxm25fayvbxwdpl@pelzflorian.localdomain/
diff --git a/website/i18n-howto.txt b/website/i18n-howto.txt
new file mode 100644
index 0000000..0d0c7c1

Checking patch website/i18n-howto.txt...
Applied patch website/i18n-howto.txt cleanly.

skipping https://yhetil.org/guix-bugs/20190906142548.4crfjgvxilgalgrs@pelzflorian.localdomain/ for 0d0c7c1
index at:
100644 0d0c7c1f38ababc6f4d8e007ed1ebabe94d9e31a	website/i18n-howto.txt

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).