Add languages (#21870)

* add persian, croatian, and slovak

* i18n

* fix formatting due to new version of ruff
This commit is contained in:
Josh Hawkins 2026-02-03 13:29:52 -06:00 committed by GitHub
parent 06141b900e
commit 21e4b36c7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 19 additions and 11 deletions

View File

@ -73,7 +73,7 @@ def get_faces():
face_dict[name] = []
for file in filter(
lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(face_dir),
):
face_dict[name].append(file)
@ -582,7 +582,7 @@ def get_classification_dataset(name: str):
dataset_dict[category_name] = []
for file in filter(
lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(category_dir),
):
dataset_dict[category_name].append(file)
@ -693,7 +693,7 @@ def get_classification_images(name: str):
status_code=200,
content=list(
filter(
lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(train_dir),
)
),

View File

@ -695,7 +695,7 @@ def write_classification_attempt(
# delete oldest face image if maximum is reached
try:
files = sorted(
filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
filter(lambda f: f.endswith(".webp"), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)

View File

@ -539,7 +539,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
cv2.imwrite(file, frame)
files = sorted(
filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
filter(lambda f: f.endswith(".webp"), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)

View File

@ -26,15 +26,16 @@ LOG_HANDLER.setFormatter(
# filter out norfair warning
LOG_HANDLER.addFilter(
lambda record: not record.getMessage().startswith(
"You are using a scalar distance function"
lambda record: (
not record.getMessage().startswith("You are using a scalar distance function")
)
)
# filter out tflite logging
LOG_HANDLER.addFilter(
lambda record: "Created TensorFlow Lite XNNPACK delegate for CPU."
not in record.getMessage()
lambda record: (
"Created TensorFlow Lite XNNPACK delegate for CPU." not in record.getMessage()
)
)

View File

@ -208,8 +208,10 @@ class RecordingMaintainer(threading.Thread):
processed_segment_count = len(
list(
filter(
lambda r: r["start_time"].timestamp()
< most_recently_processed_frame_time,
lambda r: (
r["start_time"].timestamp()
< most_recently_processed_frame_time
),
grouped_recordings[camera],
)
)

View File

@ -193,6 +193,7 @@
"yue": "粵語 (Cantonese)",
"th": "ไทย (Thai)",
"ca": "Català (Catalan)",
"hr": "Hrvatski (Croatian)",
"sr": "Српски (Serbian)",
"sl": "Slovenščina (Slovenian)",
"lt": "Lietuvių (Lithuanian)",

View File

@ -37,6 +37,7 @@ const localeMap: Record<string, () => Promise<Locale>> = {
lt: () => import("date-fns/locale/lt").then((module) => module.lt),
th: () => import("date-fns/locale/th").then((module) => module.th),
ca: () => import("date-fns/locale/ca").then((module) => module.ca),
hr: () => import("date-fns/locale/hr").then((module) => module.hr),
};
export function useDateLocale(): Locale {

View File

@ -17,9 +17,12 @@ export const supportedLanguageKeys = [
"vi",
"th",
"he",
"fa",
"ru",
"tr",
"pl",
"hr",
"sk",
"lt",
"uk",
"cs",