MCPcopy Index your code
hub / github.com/RustPython/RustPython / _print_locale

Function _print_locale

Lib/locale.py:1722–1765  ·  view source on GitHub ↗

Test function.

()

Source from the content-addressed store, hash-verified

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

Callers 1

locale.pyFile · 0.85

Calls 6

_init_categoriesFunction · 0.85
getdefaultlocaleFunction · 0.85
getlocaleFunction · 0.85
setlocaleFunction · 0.70
printFunction · 0.50
itemsMethod · 0.45

Tested by

no test coverage detected