Add languages (#21870)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled

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

View File

@ -695,7 +695,7 @@ def write_classification_attempt(
# delete oldest face image if maximum is reached # delete oldest face image if maximum is reached
try: try:
files = sorted( 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)), key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True, reverse=True,
) )

View File

@ -539,7 +539,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
cv2.imwrite(file, frame) cv2.imwrite(file, frame)
files = sorted( 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)), key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True, reverse=True,
) )

View File

@ -26,15 +26,16 @@ LOG_HANDLER.setFormatter(
# filter out norfair warning # filter out norfair warning
LOG_HANDLER.addFilter( LOG_HANDLER.addFilter(
lambda record: not record.getMessage().startswith( lambda record: (
"You are using a scalar distance function" not record.getMessage().startswith("You are using a scalar distance function")
) )
) )
# filter out tflite logging # filter out tflite logging
LOG_HANDLER.addFilter( LOG_HANDLER.addFilter(
lambda record: "Created TensorFlow Lite XNNPACK delegate for CPU." lambda record: (
not in record.getMessage() "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( processed_segment_count = len(
list( list(
filter( filter(
lambda r: r["start_time"].timestamp() lambda r: (
< most_recently_processed_frame_time, r["start_time"].timestamp()
< most_recently_processed_frame_time
),
grouped_recordings[camera], grouped_recordings[camera],
) )
) )

View File

@ -193,6 +193,7 @@
"yue": "粵語 (Cantonese)", "yue": "粵語 (Cantonese)",
"th": "ไทย (Thai)", "th": "ไทย (Thai)",
"ca": "Català (Catalan)", "ca": "Català (Catalan)",
"hr": "Hrvatski (Croatian)",
"sr": "Српски (Serbian)", "sr": "Српски (Serbian)",
"sl": "Slovenščina (Slovenian)", "sl": "Slovenščina (Slovenian)",
"lt": "Lietuvių (Lithuanian)", "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), lt: () => import("date-fns/locale/lt").then((module) => module.lt),
th: () => import("date-fns/locale/th").then((module) => module.th), th: () => import("date-fns/locale/th").then((module) => module.th),
ca: () => import("date-fns/locale/ca").then((module) => module.ca), ca: () => import("date-fns/locale/ca").then((module) => module.ca),
hr: () => import("date-fns/locale/hr").then((module) => module.hr),
}; };
export function useDateLocale(): Locale { export function useDateLocale(): Locale {

View File

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