MCPcopy Index your code
hub / github.com/python/cpython / _print_locale

Function _print_locale

Lib/locale.py:1731–1774  ·  view source on GitHub ↗

Test function.

()

Source from the content-addressed store, hash-verified

1729}
1730
1731def _print_locale():
1732
1733 """ Test function.
1734 """
1735 categories = {}
1736 def _init_categories(categories=categories):
1737 for k,v in globals().items():
1738 if k[:3] == 'LC_':
1739 categories[k] = v
1740 _init_categories()
1741 del categories['LC_ALL']
1742
1743 print('Locale defaults as determined by getdefaultlocale():')
1744 print('-'*72)
1745 lang, enc = getdefaultlocale()
1746 print('Language: ', lang or '(undefined)')
1747 print('Encoding: ', enc or '(undefined)')
1748 print()
1749
1750 print('Locale settings on startup:')
1751 print('-'*72)
1752 for name,category in categories.items():
1753 print(name, '...')
1754 lang, enc = getlocale(category)
1755 print(' Language: ', lang or '(undefined)')
1756 print(' Encoding: ', enc or '(undefined)')
1757 print()
1758
1759 try:
1760 setlocale(LC_ALL, "")
1761 except:
1762 print('NOTE:')
1763 print('setlocale(LC_ALL, "") does not support the default locale')
1764 print('given in the OS environment variables.')
1765 else:
1766 print()
1767 print('Locale settings after calling setlocale(LC_ALL, ""):')
1768 print('-'*72)
1769 for name,category in categories.items():
1770 print(name, '...')
1771 lang, enc = getlocale(category)
1772 print(' Language: ', lang or '(undefined)')
1773 print(' Encoding: ', enc or '(undefined)')
1774 print()
1775
1776###
1777

Callers 1

locale.pyFile · 0.85

Calls 5

_init_categoriesFunction · 0.85
getdefaultlocaleFunction · 0.85
getlocaleFunction · 0.85
setlocaleFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…