46
46
# find this format documented anywhere.
47
47
48
48
49
- import locale
50
49
import os
51
50
import re
52
51
import sys
@@ -210,6 +209,7 @@ def func(n):
210
209
211
210
212
211
def _expand_lang (loc ):
212
+ import locale
213
213
loc = locale .normalize (loc )
214
214
COMPONENT_CODESET = 1 << 0
215
215
COMPONENT_TERRITORY = 1 << 1
@@ -278,6 +278,7 @@ def lgettext(self, message):
278
278
import warnings
279
279
warnings .warn ('lgettext() is deprecated, use gettext() instead' ,
280
280
DeprecationWarning , 2 )
281
+ import locale
281
282
if self ._fallback :
282
283
with warnings .catch_warnings ():
283
284
warnings .filterwarnings ('ignore' , r'.*\blgettext\b.*' ,
@@ -299,6 +300,7 @@ def lngettext(self, msgid1, msgid2, n):
299
300
import warnings
300
301
warnings .warn ('lngettext() is deprecated, use ngettext() instead' ,
301
302
DeprecationWarning , 2 )
303
+ import locale
302
304
if self ._fallback :
303
305
with warnings .catch_warnings ():
304
306
warnings .filterwarnings ('ignore' , r'.*\blngettext\b.*' ,
@@ -462,6 +464,7 @@ def lgettext(self, message):
462
464
import warnings
463
465
warnings .warn ('lgettext() is deprecated, use gettext() instead' ,
464
466
DeprecationWarning , 2 )
467
+ import locale
465
468
missing = object ()
466
469
tmsg = self ._catalog .get (message , missing )
467
470
if tmsg is missing :
@@ -476,6 +479,7 @@ def lngettext(self, msgid1, msgid2, n):
476
479
import warnings
477
480
warnings .warn ('lngettext() is deprecated, use ngettext() instead' ,
478
481
DeprecationWarning , 2 )
482
+ import locale
479
483
try :
480
484
tmsg = self ._catalog [(msgid1 , self .plural (n ))]
481
485
except KeyError :
@@ -668,6 +672,7 @@ def ldgettext(domain, message):
668
672
import warnings
669
673
warnings .warn ('ldgettext() is deprecated, use dgettext() instead' ,
670
674
DeprecationWarning , 2 )
675
+ import locale
671
676
codeset = _localecodesets .get (domain )
672
677
try :
673
678
with warnings .catch_warnings ():
@@ -695,6 +700,7 @@ def ldngettext(domain, msgid1, msgid2, n):
695
700
import warnings
696
701
warnings .warn ('ldngettext() is deprecated, use dngettext() instead' ,
697
702
DeprecationWarning , 2 )
703
+ import locale
698
704
codeset = _localecodesets .get (domain )
699
705
try :
700
706
with warnings .catch_warnings ():
0 commit comments