Skip to content

Commit 5210fa2

Browse files
committed
UPD: deprecation warning will be displayed when use _()
1 parent 7b7486e commit 5210fa2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

jupyter_server/transutils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
# Distributed under the terms of the Modified BSD License.
55

66
import os
7+
import warnings
78
import gettext
89

910

11+
def _trans_gettext_deprecation_helper(*args, **kwargs):
12+
warn_msg = "The alias `_()` will be deprecated. Use `_i18n()` instead."
13+
warnings.warn(warn_msg, FutureWarning)
14+
return trans.gettext(*args, **kwargs)
15+
16+
1017
# Set up message catalog access
1118
base_dir = os.path.realpath(os.path.join(__file__, '..', '..'))
1219
trans = gettext.translation('notebook', localedir=os.path.join(base_dir, 'notebook/i18n'), fallback=True)
20+
_ = _trans_gettext_deprecation_helper
1321
_i18n = trans.gettext

0 commit comments

Comments
 (0)