Skip to content

Commit dffdab1

Browse files
authored
fix "rest_hostname" value for .transifexrc (#83)
1 parent c327016 commit dffdab1

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Documentation
2020
Bug Fixes
2121
---------
2222

23+
- Fixed errors in the ``~/.transifexrc`` file generated by the ``create-transifexrc`` command;
24+
the correct value for ``rest_hostname`` is ``https://rest.api.transifex.com``.
25+
Note: ``create-transifexrc`` command and ``SPHINXINTL_TRANSIFEX_TOKEN`` have been deprecated.
26+
They will be removed after six months. Please use the TX_TOKEN environment variable instead.
27+
2328
2.1.0 (2023/02/05)
2429
==================
2530

sphinx_intl/commands.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010
import re
1111
import os
12+
import warnings
1213
from glob import glob
1314

1415
import click
@@ -134,7 +135,7 @@ def convert(self, value, param, ctx):
134135
'--transifex-token',
135136
envvar=ENVVAR_PREFIX + '_TRANSIFEX_TOKEN',
136137
type=str, metavar='<TOKEN>', required=True,
137-
help="Your transifex token.")
138+
help="Your transifex token. (DEPRECATED)")
138139

139140
option_transifex_organization_name = click.option(
140141
'--transifex-organization-name',
@@ -300,8 +301,16 @@ def stat(locale_dir, language):
300301
@option_transifex_token
301302
def create_transifexrc(transifex_token):
302303
"""
303-
Create `$HOME/.transifexrc`
304+
Create `$HOME/.transifexrc` (deprecated)
304305
"""
306+
warnings.filterwarnings("default", category=DeprecationWarning)
307+
warnings.warn(
308+
(
309+
"create-transifexrc command and SPHINXINTL_TRANSIFEX_TOKEN "
310+
"will be deprecated. Please use TX_TOKEN environment variable instead."
311+
),
312+
category=DeprecationWarning,
313+
)
305314
transifex.create_transifexrc(transifex_token)
306315

307316

sphinx_intl/transifex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
TRANSIFEXRC_TEMPLATE = """\
3131
[https://www.transifex.com]
32-
rest_hostname = https://www.transifex.com
32+
rest_hostname = https://rest.api.transifex.com
3333
token = %(transifex_token)s
3434
"""
3535

0 commit comments

Comments
 (0)