MCPcopy Index your code
hub / github.com/bpython/bpython / init

Function init

bpython/translations/__init__.py:20–40  ·  view source on GitHub ↗
(
    locale_dir: str | None = None, languages: list[str] | None = None
)

Source from the content-addressed store, hash-verified

18
19
20def init(
21 locale_dir: str | None = None, languages: list[str] | None = None
22) -> None:
23 try:
24 locale.setlocale(locale.LC_ALL, "")
25 except locale.Error:
26 # This means that the user's environment is broken. Let's just continue
27 # with the default C locale.
28 sys.stderr.write(
29 "Error: Your locale settings are not supported by "
30 "the system. Using the fallback 'C' locale instead. "
31 "Please fix your locale settings.\n"
32 )
33
34 global translator
35 if locale_dir is None:
36 locale_dir = os.path.join(package_dir, "translations")
37
38 translator = gettext.translation(
39 "bpython", locale_dir, languages, fallback=True
40 )

Callers 1

setUpClassMethod · 0.90

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected