-
Notifications
You must be signed in to change notification settings - Fork 53
/
TRANSLATION_README
108 lines (70 loc) · 2.85 KB
/
TRANSLATION_README
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
============
Installation
============
To install all required packages run:
$ pip install -r djbook/deps.txt
============
How to start
============
You can find .po files in `locale/ru/LC_MESSAGES` folder.
To build documentation HTML run:
$ ./translator.py create
Generated HTML you can find in `_build/html`.
So find .po you wish to translate, add changes and run `./translator.py create`.
=============
translator.py
=============
----------
Base usage
----------
To list all command run:
$ ./translator.py --help
To get info about some command run:
$ ./translator.py help [command_name]
--------------
Output control
--------------
Use ``--debug`` option to see debug info and error traceback.
Use ``-v`` for verbose output.
Use ``-q`` for quiet execute.
---------------
Add new command
---------------
We use https://github.com/dhellmann/cliff with a little bit fixed command loader.
You can find command in ``djbook.commands`` package.
There are three level of output:
self.app.stdout.write('hi!\n') # default output
self.log.info('sending greeting') # verbose output
self.log.debug('debugging') # debug output
====================================================
Update documentation from Django source code
====================================================
Visit https://github.com/django/django, find required tag. Run:
$ ./translator.py update <tag>
Also there is a little hack to translate hard-coded text.
Add `from sphinx.locale import l_` to `_ext/djangodocs.py` and wrap `version_text` with `l_`.
You may need update localization, see description under.
========================
Translate hardcoded text
========================
Create _ext/locale/django.pot:
pybabel extract -k _ -k l_ -k lazy_gettext -o djbook/sphinx.pot _ext/
Update locale catalog:
pybabel update -i djbook/sphinx.pot -d locale/ -l ru -D sphinx
Create locale catalog(already created):
pybabel init -i djbook/sphinx.pot -d locale/ -l ru -D sphinx
=====
Notes
=====
In `djbook/_theme/djbook/layout.html` are hardcoded link to comments scripts from server.
Do not forget have them up to date.
=====
Hints
=====
В оригинале часто используют ссылки следующего вида:
`define and send your own custom signals`_
Sphinx при переводе сначала подставляет перевод, потом рендерит html, по этому
просто перевести текст нельзя т.к. метки с таким названием не будет. Для этого
используем http://sphinx-doc.org/markup/inline.html#ref-role найдя в исходниках
страницы название метки. Например:
:ref:`определять и посылать свои собственные сигналы <defining-and-sending-signals>`