summaryrefslogtreecommitdiff
path: root/po/HOWTO
blob: 804e2a7ebfbbe572bad04ed0b39345502d718773 (plain)
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
README for pacpur's translators
===============================

Note:   The target locale must be available on your system.
        See https://wiki.archlinux.org/index.php/Locale

Add a new translation
---------------------
To add a new translation, generate a new <locale>.po file from the current code,
where <locale> is one of the locales given in /usr/share/i18n/locales:

$ cd ./pacpur
$ bash --dump-po-strings pacpur > pacpur.pot
$ msguniq pacpur.pot > po/<locale>.po

If applicable, use the 'short' locale (de, es, fr, ...) to make it available to
all sublocales. Use the regular locale (en_GB, en_AU, ..., zh_CN, zh_TW) when
this is not applicable.

Open the po/<locale>.po file and add or fill in the header entry. This can be
done manually with your favorite text editor or automatically with a PO editor.

msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Language: <locale>\n"
"X-Source-Language: C\n"

Then add your translation in the following 'msgstr' fields. Do not replace the
original text in the 'msgid' fields.

#: hello:5
msgid "Hello, world!"
msgstr "世界你好!"

Notes:
- Do not use non breaking space characters to avoid problematic display issues.

Update a translation
--------------------
To update an existing translation, generate the updated pacpur.pot file and merge
the existing changes:

$ cd ./pacpur
$ bash --dump-po-strings pacpur > pacpur.pot
$ msguniq pacpur.pot > pacpur.po
$ msgmerge --update po/<locale>.po pacpur.po

Open the po/<locale>.po file and check for new or 'fuzzy' strings.

Testing your translation
------------------------
To test your translation, compile the source <locale>.po file and install it on
your system:

cd ./pacpur
msgfmt -o /usr/share/locale/<locale>/LC_MESSAGES/pacpur.mo po/<locale>.po

To launch pacpur with a specific locale:

$ LANG=<locale> pacpur -S package

Sending your translation
------------------------
Translation can be sent through GitHub pull request on https://github.com/rmarquis/pacpur.
Beware of pulling the source <locale>.po file, not the compiled <locale>.po file.

Resources
---------
http://www.gnu.org/software/gettext/manual/gettext.html