mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Explicitly set Khoj to use the default locale of the user (#425)
- Explicitly set locale using `locale.setLocale(locale.LC_ALL, '')` for localization. Relevant for datetime libraries. See [Python 3 documentation](https://docs.python.org/3/library/locale.html#locale.setlocale).
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
import locale
|
||||||
|
|
||||||
if sys.stdout is None:
|
if sys.stdout is None:
|
||||||
sys.stdout = open(os.devnull, "w")
|
sys.stdout = open(os.devnull, "w")
|
||||||
@@ -32,6 +33,9 @@ from khoj.utils.cli import cli
|
|||||||
# Initialize the Application Server
|
# Initialize the Application Server
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
# Set Locale
|
||||||
|
locale.setlocale(locale.LC_ALL, "")
|
||||||
|
|
||||||
# Setup Logger
|
# Setup Logger
|
||||||
rich_handler = RichHandler(rich_tracebacks=True)
|
rich_handler = RichHandler(rich_tracebacks=True)
|
||||||
rich_handler.setFormatter(fmt=logging.Formatter(fmt="%(message)s", datefmt="[%X]"))
|
rich_handler.setFormatter(fmt=logging.Formatter(fmt="%(message)s", datefmt="[%X]"))
|
||||||
|
|||||||
Reference in New Issue
Block a user