Skip to content

Commit 5279170

Browse files
authored
Merge pull request #830 from python-babel/docs-fixes
Documentation fixes
2 parents 227d1ec + dc8d383 commit 5279170

12 files changed

Lines changed: 220 additions & 167 deletions

File tree

.readthedocs.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
2+
3+
version: 2
4+
5+
build:
6+
os: ubuntu-20.04
7+
tools:
8+
python: "3.9"
9+
10+
sphinx:
11+
configuration: docs/conf.py
12+
13+
formats:
14+
- epub
15+
- pdf
16+
17+
python:
18+
install:
19+
- requirements: docs/requirements.txt

CHANGES renamed to CHANGES.rst

Lines changed: 110 additions & 110 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include Makefile CHANGES LICENSE AUTHORS
1+
include Makefile CHANGES.rst LICENSE AUTHORS
22
include conftest.py tox.ini
33
include babel/global.dat
44
include babel/locale-data/*.dat

babel/dates.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,22 @@ def get_next_timezone_transition(zone=None, dt=None):
255255
class TimezoneTransition(object):
256256
"""A helper object that represents the return value from
257257
:func:`get_next_timezone_transition`.
258+
259+
:field activates:
260+
The time of the activation of the timezone transition in UTC.
261+
:field from_tzinfo:
262+
The timezone from where the transition starts.
263+
:field to_tzinfo:
264+
The timezone for after the transition.
265+
:field reference_date:
266+
The reference date that was provided. This is the `dt` parameter
267+
to the :func:`get_next_timezone_transition`.
258268
"""
259269

260270
def __init__(self, activates, from_tzinfo, to_tzinfo, reference_date=None):
261-
#: the time of the activation of the timezone transition in UTC.
262271
self.activates = activates
263-
#: the timezone from where the transition starts.
264272
self.from_tzinfo = from_tzinfo
265-
#: the timezone for after the transition.
266273
self.to_tzinfo = to_tzinfo
267-
#: the reference date that was provided. This is the `dt` parameter
268-
#: to the :func:`get_next_timezone_transition`.
269274
self.reference_date = reference_date
270275

271276
@property

babel/messages/extract.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,7 @@ def extract_javascript(fileobj, keywords, comment_tags, options):
512512
:param options: a dictionary of additional options (optional)
513513
Supported options are:
514514
* `jsx` -- set to false to disable JSX/E4X support.
515-
* `template_string` -- set to false to disable ES6
516-
template string support.
515+
* `template_string` -- set to false to disable ES6 template string support.
517516
"""
518517
from babel.messages.jslexer import Token, tokenize, unquote_string
519518
funcname = message_lineno = None

docs/api/dates.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Timezone Functionality
4242

4343
A timezone object for the computer's local timezone.
4444

45+
.. autoclass:: TimezoneTransition
46+
4547
Data Access
4648
-----------
4749

docs/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.. include:: ../CHANGES
1+
.. include:: ../CHANGES.rst

docs/cmdline.rst

Lines changed: 69 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ systems.
1414
When properly installed, Babel provides a script called ``pybabel``::
1515

1616
$ pybabel --help
17-
usage: pybabel command [options] [args]
17+
Usage: pybabel command [options] [args]
1818

19-
options:
19+
Options:
2020
--version show program's version number and exit
2121
-h, --help show this help message and exit
2222
--list-locales print all known locales and exit
@@ -40,24 +40,25 @@ The ``compile`` sub-command can be used to compile translation catalogs into
4040
binary MO files::
4141

4242
$ pybabel compile --help
43-
usage: pybabel compile [options]
43+
Usage: pybabel compile [options]
4444

4545
compile message catalogs to MO files
4646

47-
options:
47+
Options:
4848
-h, --help show this help message and exit
4949
-D DOMAIN, --domain=DOMAIN
50-
domain of MO and PO files (default 'messages')
51-
-d DIR, --directory=DIR
52-
base directory of catalog files
53-
-l LOCALE, --locale=LOCALE
54-
locale of the catalog
55-
-i FILE, --input-file=FILE
50+
domains of PO files (space separated list, default
51+
'messages')
52+
-d DIRECTORY, --directory=DIRECTORY
53+
path to base directory containing the catalogs
54+
-i INPUT_FILE, --input-file=INPUT_FILE
5655
name of the input file
57-
-o FILE, --output-file=FILE
56+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
5857
name of the output file (default
5958
'<output_dir>/<locale>/LC_MESSAGES/<domain>.mo')
60-
-f, --use-fuzzy also include fuzzy translations (default False)
59+
-l LOCALE, --locale=LOCALE
60+
locale of the catalog to compile
61+
-f, --use-fuzzy also include fuzzy translations
6162
--statistics print statistics about translations
6263

6364
If ``directory`` is specified, but ``output-file`` is not, the default filename
@@ -77,39 +78,53 @@ The ``extract`` sub-command can be used to extract localizable messages from
7778
a collection of source files::
7879

7980
$ pybabel extract --help
80-
usage: pybabel extract [options] dir1 <dir2> ...
81+
Usage: pybabel extract [options] <input-paths>
8182

8283
extract messages from source files and generate a POT file
8384

84-
options:
85+
Options:
8586
-h, --help show this help message and exit
86-
--charset=CHARSET charset to use in the output (default "utf-8")
87-
-k KEYWORDS, --keyword=KEYWORDS
88-
keywords to look for in addition to the defaults. You
89-
can specify multiple -k flags on the command line.
87+
--charset=CHARSET charset to use in the output file (default "utf-8")
88+
-k KEYWORDS, --keywords=KEYWORDS, --keyword=KEYWORDS
89+
space-separated list of keywords to look for in
90+
addition to the defaults (may be repeated multiple
91+
times)
9092
--no-default-keywords
9193
do not include the default keywords
92-
-F MAPPING_FILE, --mapping=MAPPING_FILE
93-
path to the extraction mapping file
94+
-F MAPPING_FILE, --mapping-file=MAPPING_FILE, --mapping=MAPPING_FILE
95+
path to the mapping configuration file
9496
--no-location do not include location comments with filename and
9597
line number
98+
--add-location=ADD_LOCATION
99+
location lines format. If it is not given or "full",
100+
it generates the lines with both file name and line
101+
number. If it is "file", the line number part is
102+
omitted. If it is "never", it completely suppresses
103+
the lines (same as --no-location).
96104
--omit-header do not include msgid "" entry in header
97-
-o OUTPUT, --output=OUTPUT
98-
path to the output POT file
105+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE, --output=OUTPUT_FILE
106+
name of the output file
99107
-w WIDTH, --width=WIDTH
100108
set output line width (default 76)
101109
--no-wrap do not break long message lines, longer than the
102110
output line width, into several lines
103111
--sort-output generate sorted output (default False)
104112
--sort-by-file sort output by file location (default False)
105-
--msgid-bugs-address=EMAIL@ADDRESS
113+
--msgid-bugs-address=MSGID_BUGS_ADDRESS
106114
set report address for msgid
107115
--copyright-holder=COPYRIGHT_HOLDER
108116
set copyright holder in output
109-
-c TAG, --add-comments=TAG
117+
--project=PROJECT set project name in output
118+
--version=VERSION set project version in output
119+
-c ADD_COMMENTS, --add-comments=ADD_COMMENTS
110120
place comment block with TAG (or those preceding
111-
keyword lines) in output file. One TAG per argument
112-
call
121+
keyword lines) in output file. Separate multiple TAGs
122+
with commas(,)
123+
-s, --strip-comments, --strip-comment-tags
124+
strip the comment TAGs from the comments.
125+
--input-dirs=INPUT_DIRS
126+
alias for input-paths (does allow files as well as
127+
directories).
113128

114129

115130
init
@@ -119,24 +134,27 @@ The `init` sub-command creates a new translations catalog based on a PO
119134
template file::
120135

121136
$ pybabel init --help
122-
usage: pybabel init [options]
137+
Usage: pybabel init [options]
123138

124139
create new message catalogs from a POT file
125140

126-
options:
141+
Options:
127142
-h, --help show this help message and exit
128143
-D DOMAIN, --domain=DOMAIN
129144
domain of PO file (default 'messages')
130-
-i FILE, --input-file=FILE
145+
-i INPUT_FILE, --input-file=INPUT_FILE
131146
name of the input file
132-
-d DIR, --output-dir=DIR
147+
-d OUTPUT_DIR, --output-dir=OUTPUT_DIR
133148
path to output directory
134-
-o FILE, --output-file=FILE
149+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
135150
name of the output file (default
136151
'<output_dir>/<locale>/LC_MESSAGES/<domain>.po')
137152
-l LOCALE, --locale=LOCALE
138153
locale for the new localized catalog
139-
154+
-w WIDTH, --width=WIDTH
155+
set output line width (default 76)
156+
--no-wrap do not break long message lines, longer than the
157+
output line width, into several lines
140158

141159
update
142160
======
@@ -145,29 +163,36 @@ The `update` sub-command updates an existing new translations catalog based on
145163
a PO template file::
146164

147165
$ pybabel update --help
148-
usage: pybabel update [options]
166+
Usage: pybabel update [options]
149167

150168
update existing message catalogs from a POT file
151169

152-
options:
170+
Options:
153171
-h, --help show this help message and exit
154172
-D DOMAIN, --domain=DOMAIN
155173
domain of PO file (default 'messages')
156-
-i FILE, --input-file=FILE
174+
-i INPUT_FILE, --input-file=INPUT_FILE
157175
name of the input file
158-
-d DIR, --output-dir=DIR
159-
path to output directory
160-
-o FILE, --output-file=FILE
176+
-d OUTPUT_DIR, --output-dir=OUTPUT_DIR
177+
path to base directory containing the catalogs
178+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
161179
name of the output file (default
162180
'<output_dir>/<locale>/LC_MESSAGES/<domain>.po')
181+
--omit-header do not include msgid entry in header
163182
-l LOCALE, --locale=LOCALE
164-
locale of the translations catalog
165-
--ignore-obsolete do not include obsolete messages in the output
166-
(default False)
183+
locale of the catalog to compile
184+
-w WIDTH, --width=WIDTH
185+
set output line width (default 76)
186+
--no-wrap do not break long message lines, longer than the
187+
output line width, into several lines
188+
--ignore-obsolete whether to omit obsolete messages from the output
189+
--init-missing if any output files are missing, initialize them first
167190
-N, --no-fuzzy-matching
168-
do not use fuzzy matching (default False)
169-
--previous keep previous msgids of translated messages (default
170-
False)
191+
do not use fuzzy matching
192+
--update-header-comment
193+
update target header comment
194+
--previous keep previous msgids of translated messages
195+
171196

172197
If ``output_dir`` is specified, but ``output-file`` is not, the default
173198
filename of the output file will be::

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@
224224
# One entry per manual page. List of tuples
225225
# (source start file, name, description, authors, manual section).
226226
man_pages = [
227-
('index_', 'babel', u'Babel Documentation',
228-
[u'The Babel Team'], 1)
227+
('index', 'babel', u'Babel Documentation', [u'The Babel Team'], 1),
229228
]
230229

231230
# If true, show URL addresses after external links.

docs/numbers.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ Examples:
1818

1919
.. code-block:: pycon
2020
21+
# Numbers with decimal places
2122
>>> format_decimal(1.2345, locale='en_US')
2223
u'1.234'
2324
>>> format_decimal(1.2345, locale='sv_SE')
2425
u'1,234'
26+
# Integers with thousand grouping
2527
>>> format_decimal(12345, locale='de_DE')
2628
u'12.345'
27-
29+
>>> format_decimal(12345678, locale='de_DE')
30+
u'12.345.678'
2831
2932
Pattern Syntax
3033
==============

0 commit comments

Comments
 (0)