unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 66d19d07a02c824faf2e8235a3f0eb6f3173b4b4 2524 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
 
With sexp-xgettext, arbitrary s-expressions can be marked for
translations (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.

=====

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 test:

guix environment --ad-hoc haunt
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 e.g.:

GUILE_LOAD_PATH=.:$(guix build haunt)/share/guile/site/2.2:$GUILE_LOAD_PATH guile apps/base/templates/about.scm

debug log:

solving 66d19d0 ...
found 66d19d0 in https://yhetil.org/guix-devel/20190807223310.yiwzodu7fwjhvrm6@pelzflorian.localdomain/

applying [1/1] https://yhetil.org/guix-devel/20190807223310.yiwzodu7fwjhvrm6@pelzflorian.localdomain/
diff --git a/website/i18n-howto.txt b/website/i18n-howto.txt
new file mode 100644
index 0000000..66d19d0

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

index at:
100644 66d19d07a02c824faf2e8235a3f0eb6f3173b4b4	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).