Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "make lazy import locale in gettext"
This reverts commit 58d39a3.
  • Loading branch information
shihai1991 committed May 4, 2020
commit cef2725b06e5de95da8d7657c3c689250f3d39ff
8 changes: 1 addition & 7 deletions Lib/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# find this format documented anywhere.


import locale
import os
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write a separated PR for gettext, and keep this PR for test.support.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I created #19905 to do this job.

import re
import sys
Expand Down Expand Up @@ -209,7 +210,6 @@ def func(n):


def _expand_lang(loc):
import locale
loc = locale.normalize(loc)
COMPONENT_CODESET = 1 << 0
COMPONENT_TERRITORY = 1 << 1
Expand Down Expand Up @@ -275,7 +275,6 @@ def gettext(self, message):
return message

def lgettext(self, message):
import locale
import warnings
warnings.warn('lgettext() is deprecated, use gettext() instead',
DeprecationWarning, 2)
Expand All @@ -297,7 +296,6 @@ def ngettext(self, msgid1, msgid2, n):
return msgid2

def lngettext(self, msgid1, msgid2, n):
import locale
import warnings
warnings.warn('lngettext() is deprecated, use ngettext() instead',
DeprecationWarning, 2)
Expand Down Expand Up @@ -461,7 +459,6 @@ def _parse(self, fp):
transidx += 8

def lgettext(self, message):
import locale
import warnings
warnings.warn('lgettext() is deprecated, use gettext() instead',
DeprecationWarning, 2)
Expand All @@ -476,7 +473,6 @@ def lgettext(self, message):
return tmsg.encode(locale.getpreferredencoding())

def lngettext(self, msgid1, msgid2, n):
import locale
import warnings
warnings.warn('lngettext() is deprecated, use ngettext() instead',
DeprecationWarning, 2)
Expand Down Expand Up @@ -669,7 +665,6 @@ def dgettext(domain, message):
return t.gettext(message)

def ldgettext(domain, message):
import locale
import warnings
warnings.warn('ldgettext() is deprecated, use dgettext() instead',
DeprecationWarning, 2)
Expand Down Expand Up @@ -697,7 +692,6 @@ def dngettext(domain, msgid1, msgid2, n):
return t.ngettext(msgid1, msgid2, n)

def ldngettext(domain, msgid1, msgid2, n):
import locale
import warnings
warnings.warn('ldngettext() is deprecated, use dngettext() instead',
DeprecationWarning, 2)
Expand Down